Bug 6333 - Win32: Bad file descriptor in SubProcBackChannel
Summary: Win32: Bad file descriptor in SubProcBackChannel
Status: RESOLVED INVALID
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamc/spamd (show other bugs)
Version: 3.3.0
Hardware: Other Windows XP
: P5 minor
Target Milestone: 3.3.2
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-11 14:18 UTC by Daniel Lemke
Modified: 2010-06-03 17:17 UTC (History)
3 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Lemke 2010-02-11 14:18:55 UTC
Another error during execution of spamd in Win32:


backchannel: set non-blocking failed: Bad file descriptor at C:/Perl/site/lib/Mail/SpamAssassin/SubProcBackChannel.pm line 81.


Line 81: $self->{parent}->blocking(0)
Comment 1 Daniel Lemke 2010-02-11 14:19:13 UTC
Can be "solved" like this:

@@ -74,12 +74,14 @@
   ($self->{latest_kid_fh}, $self->{parent}) =
             $io->socketpair(AF_UNIX,SOCK_STREAM,PF_UNSPEC)
             or die "backchannel: socketpair failed: $!";
-
-  # set those to use non-blocking I/O
-  $self->{parent}->blocking(0)
-            or die "backchannel: set non-blocking failed: $!";
-  $self->{latest_kid_fh}->blocking(0)
-            or die "backchannel: set non-blocking failed: $!";
+        
+	# set those to use non-blocking I/O
+	if (!Mail::SpamAssassin::Util::am_running_on_windows()) {  
+		  $self->{parent}->blocking(0)
+		            or die "backchannel: set non-blocking failed: $!";
+		  $self->{latest_kid_fh}->blocking(0)
+		            or die "backchannel: set non-blocking failed: $!";
+	}
 }
 
 sub setup_backchannel_parent_post_fork {
Comment 2 Justin Mason 2010-02-11 15:37:16 UTC
um, I would assume that would have pretty serious consequences.  Can you use round robin instead?
Comment 3 Daniel Lemke 2010-02-12 11:57:17 UTC
That may be but for now it's working fine and the spamd is running pretty stable (next step is to replace the old 323 spamd and testing it in production environment).

Most of these fixes were already documented in SAWin32 and ran very stable. If there don't appear any bigger issues, I'd suggest to add the fixes to the sa source (since it's irrelevant to the stability of the unix version anyway).
Comment 4 Daniel Lemke 2010-03-01 15:50:22 UTC
After some research it appears to be a windows specific problem with the IO::Socket module so there is no need to patch it into SA source.

A bugfix is mentioned here:
http://rt.perl.org/rt3/Public/Bug/Display.html?id=27044

Commenting out both "$self->{parent}->blocking(0)" - lines works pretty stable for me but the bugfix mentioned above should be much more solid. If I'm able to make it work with it, I'll mention here.
Comment 5 Kevin A. McGrail 2010-06-01 08:15:44 UTC
(In reply to comment #4)
> After some research it appears to be a windows specific problem with the
> IO::Socket module so there is no need to patch it into SA source.
> 
> A bugfix is mentioned here:
> http://rt.perl.org/rt3/Public/Bug/Display.html?id=27044
> 
> Commenting out both "$self->{parent}->blocking(0)" - lines works pretty stable
> for me but the bugfix mentioned above should be much more solid. If I'm able to
> make it work with it, I'll mention here.

I see this as a bug in perl than a bug in SA. 

However, is there a dependency for IO::Socket that could be enforced or at least warned for Windows users during configure?
Comment 6 Kevin A. McGrail 2010-06-01 08:26:54 UTC
Changing target to 3.3.2 but that could easily be bumped.  I see this as a small is_windows and IO::Socket version check to warn the user or enforce during the initial configuration of the Makefile.PL

Similar to the existing:
 'Net::DNS'      => (RUNNING_ON_WINDOWS ? 0.46 : 0.34), # bugs in older revs

Do we know what version of IO::Socket resolved the issue?
Comment 7 Daniel Lemke 2010-06-02 03:39:33 UTC
Hmmm, made a build of latest trunk with Net-DNS 0.66 and ActivePerl 5.8.9 on a win7 and winXP machine, none of them having that error occuring.

This may be due using another repository version of Net-DNS (if available I use precompiled modules via ActiveState repository) so this issue could appear again for other perl and / or repository distributions.

Daniel
Comment 8 Kevin A. McGrail 2010-06-03 17:17:04 UTC
(In reply to comment #7)
> Hmmm, made a build of latest trunk with Net-DNS 0.66 and ActivePerl 5.8.9 on a
> win7 and winXP machine, none of them having that error occuring.
> 
> This may be due using another repository version of Net-DNS (if available I use
> precompiled modules via ActiveState repository) so this issue could appear
> again for other perl and / or repository distributions.
> 
> Daniel

OK, closing again as resolved, invalid.