Project

General

Profile

Actions

Defect #6860

closed

svn: Write error: Broken pipe when browsing repository

Added by Ве Fio over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
Start date:
2010-11-10
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I don't know how this error is getting caused, however I've been trying to track down it's origin forever. This error appears in my default error log, not in the error log for it's associated VHost for some reason. I did some testing, and after I let the activity die down to nothing for maybe 10 minutes, then I go and browse the repository and open a file in redmine, I go back to my log and I can see another "svn: Write error: Broken pipe" error. It's semi-consistent to get this error to re-occur for me.

Redmine 1.0.3
Rails 2.3.5
Ruby 1.8.7
svn 1.6.6


Files

redmine-rev-4000.png (130 KB) redmine-rev-4000.png Toshi MARUYAMA, 2010-11-12 01:04
svn-version.diff (1.23 KB) svn-version.diff Toshi MARUYAMA, 2010-11-12 13:34
Actions #1

Updated by Xiwen Cheng over 13 years ago

Sounds like SVN is being accessed over SSH? If so you'll probably see that error when you do `svn log | head`. See this thread

If above is incorrect, how is SVN set up?

Actions #2

Updated by Mischa The Evil over 13 years ago

svn: Write error: Broken pipe when browsing repository

[fixed] SVN-properties (r1627) not showing when browsing might be interesting too in your situation...

Please let me know if my fix workes for you too...

Actions #3

Updated by Ве Fio over 13 years ago

Mischa The Evil wrote:

svn: Write error: Broken pipe when browsing repository

[fixed] SVN-properties (r1627) not showing when browsing might be interesting too in your situation...

Please let me know if my fix workes for you too...

I came across this earlier, and didn't think it had anything to do with me. However, after looking through my repository, it indeed does look like SVN properties aren't showing up. Weird... In this case your fix should be the correct one. This didn't happen to my last installation.. Which is very odd. It looks like that fix was committed to trunk awhile ago, so then, why am I experiencing it? It appears that this could be a re-occurrence of it somehow. I'll do some more testing, with your fix and whatnot, and I'll let you know.

Xiwen Cheng wrote:

Sounds like SVN is being accessed over SSH? If so you'll probably see that error when you do `svn log | head`. See this thread

If above is incorrect, how is SVN set up?

It's being accessed via the default method, which is of course executing the binary directly with Redmine's SCM SVN adapter. No errors or problems appear on Redmine, other than this error in my log (except maybe that noted just above this)

Actions #4

Updated by Ве Fio over 13 years ago

Mischa The Evil,

I applied your fix and all my SVN properties are now appearing. I didn't check my error log, but as I already know that your fix fixed those broken pipe errors too, we now know the cause. Is there anything we can do to fix this on a more global scale, e.g. a commit to trunk? If you need anything more from me, let me know, I'll be happy to help you squash this bug.

Actions #5

Updated by Toshi MARUYAMA over 13 years ago

Could you try to change io.gets to io.read at source:/tags/1.0.3/lib/redmine/scm/adapters/subversion_adapter.rb#L39 ?

diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb
--- a/lib/redmine/scm/adapters/subversion_adapter.rb
+++ b/lib/redmine/scm/adapters/subversion_adapter.rb
@@ -36,7 +36,7 @@ module Redmine
             version = nil
             shellout(cmd) do |io|
               # Read svn version in first returned line
-              if m = io.gets.to_s.match(%r{((\d+\.)+\d+)})
+              if m = io.read.to_s.match(%r{((\d+\.)+\d+)})
                 version = m[0].scan(%r{\d+}).collect(&:to_i)
               end
             end

Mercurial adapter changed io.gets to io.read at r3722.

Actions #6

Updated by Toshi MARUYAMA over 13 years ago

Actions #7

Updated by Toshi MARUYAMA over 13 years ago

This is a image after patch applied of r4000.

    * svk:merge: e93f8b46-1217-0410-a6f0-8f06a7374b81:/trunk:1751
    * svn:ignore: coverage 

http://www.redmine.org/projects/redmine/repository/show/trunk?rev=4000 does not show.

Actions #8

Updated by Ве Fio over 13 years ago

Confirmed, I just removed Mischa The Evil's patch, and added yours in, and it works. Still shows the properties, and I see no broken pipe errors.

Actions #9

Updated by Mischa The Evil over 13 years ago

Toshi MARUYAMA wrote:

Could you try to change io.gets to io.read at source:/tags/1.0.3/lib/redmine/scm/adapters/subversion_adapter.rb#L39 ?

[...]

Mercurial adapter changed io.gets to io.read at r3722.

That patch solves the issue at it's root AFAICS. So it seems to be caused by the specific differences between the two different methods.

Actions #10

Updated by Toshi MARUYAMA over 13 years ago

What should I do?
Should I create unit test such as #5117 ?
I notice a patch of #5117 use io.gets.

Actions #11

Updated by Toshi MARUYAMA over 13 years ago

Following is test result with script/console.

$ LANG=C svn --version
svn, version 1.6.13 (r1002816)
   compiled Oct 11 2010, 08:18:53

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see http://subversion.tigris.org/
This product includes software developed by CollabNet (http://www.Collab.Net/).

Before applied patch

$ LANG=C RAILS_ENV=test ruby script/console               
Loading test environment (Rails 2.3.5)
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
>> v = Redmine::Scm::Adapters::SubversionAdapter.client_version
svn: Write error: Broken pipe
=> []
>> 

After applied patch

$ LANG=C RAILS_ENV=test ruby script/console
Loading test environment (Rails 2.3.5)
/usr/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010.  Use #requirement
>> v = Redmine::Scm::Adapters::SubversionAdapter.client_version
=> [1, 6, 13]
>> 
Actions #12

Updated by Toshi MARUYAMA over 13 years ago

I update a patch to read only first line of "svn --version" and I attach it.

Actions #13

Updated by Jean-Philippe Lang over 13 years ago

This patch changes #gets for #read with less changes. Can you give it a try?

Index: lib/redmine/scm/adapters/subversion_adapter.rb
===================================================================
--- lib/redmine/scm/adapters/subversion_adapter.rb    (revision 4392)
+++ lib/redmine/scm/adapters/subversion_adapter.rb    (working copy)
@@ -36,8 +36,8 @@
             version = nil
             shellout(cmd) do |io|
               # Read svn version in first returned line
-              if m = io.gets.to_s.match(%r{((\d+\.)+\d+)})
-                version = m[0].scan(%r{\d+}).collect(&:to_i)
+              if m = io.read.to_s.match(%r{\A(.*?)((\d+\.)+\d+)})
+                version = m[2].scan(%r{\d+}).collect(&:to_i)
               end
             end
             return nil if $? && $?.exitstatus != 0
Actions #14

Updated by Mischa The Evil over 13 years ago

Jean-Philippe Lang wrote:

This patch changes #gets for #read with less changes. Can you give it a try?

[...]

J-PL,

Thanks for looking at this (old) issue. It seemed to me like nobody else encountered it... Regarding your change-proposal: it works flawlessly. I vote (+1) for inclusion into Redmine 1.0.4...

Actions #15

Updated by Jean-Philippe Lang over 13 years ago

  • Target version set to 1.0.4
Actions #16

Updated by Toshi MARUYAMA over 13 years ago

As I described at note-10 of #5096, Redmine git adapter use "io.gets".
And Darcs adpter use "io.gets" at source:tags/1.0.3/lib/redmine/scm/adapters/darcs_adapter.rb#L38 .
It maybe we should use "io.each_line" instead of "io.gets".

Actions #17

Updated by Jean-Philippe Lang over 13 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Fix committed in r4419.

Toshi, I think #gets is ok as long as every lines are read.

Actions #18

Updated by Mischa The Evil over 13 years ago

Jean-Philippe Lang wrote:

Fix committed in r4419.

Thanks a lot!

Actions

Also available in: Atom PDF