You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2008/09/23 11:58:46 UTC

[Bug 5985] New: 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985

           Summary: 'message: error reading: Bad file descriptor at
                    lib/Mail/SpamAssassin/Message/Node.pm line 279'
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Libraries
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: jm@jmason.org


This message appears on a few linux systems I have here, during mass-checks and
in the "make test" output.  I've narrowed this bug down to a small testcase:

: jm 175...; ./spamassassin.raw -C tst.cf -L -t < in.txt > /dev/null
[3838] warn: config: could not find site rules directory
[3838] warn: rules: failed to run MIME_HTML_ONLY test, skipping:
[3838] warn:  (message: error reading: Bad file descriptor at
lib/Mail/SpamAssassin/Message/Node.pm line 279, <$tmpfile> line 1.
[3838] warn: )

tst.cf:---------------------------------------------------------------------

loadplugin Mail::SpamAssassin::Plugin::Check
loadplugin Mail::SpamAssassin::Plugin::MIMEEval
body MIME_HTML_ONLY eval:check_for_mime_html_only()

in.txt:---------------------------------------------------------------------

Content-Type: multipart/mixed; boundary="x7"
MIME-Version: 1.0

--x7
Content-Type: text/html

a

--x7
Content-Type: application/pdf

b
--x7--

---------------------------------------------------------------------------


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #9 from Mark Martinec <Ma...@ijs.si>  2008-10-08 03:33:35 PST ---
> will that fix Daryl's bug, do you think?

I believe it does. The read() is not prone to this perl bug
and as a bonus is even faster where we can afford reading
in chunks instead of line-by-line (e.g. when the whole file
is intended to end up in memory anyway, or when copying it
to another file). The remaining cases of line-by-line reads
now report EBADF only at a dbg level.

I did the missed cases in sa-compile.raw and sa-learn.raw today,
revision 702797. The only module still without this playing down
of severity is Client.pm.

I opened a new perlbug [perl #59550], this time against perl 5.10 and
as a general case, not as a missing NL in the last line [perl #39060].
Still waiting for some response.

> (asking because I think I may be running into it sporadically -- although I
> haven't been able to spot a mass-check where it's occurred for me recently.)

Still after my yesterday's check-in?


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #3 from Mark Martinec <Ma...@ijs.si>  2008-09-25 08:45:42 PST ---
Sending        lib/Mail/SpamAssassin/Message/Node.pm
Sending        lib/Mail/SpamAssassin/Message.pm
Committed revision 699006.

Message.pm and Message/Node.pm: replace line-by-line reading by
sysread + split, thus avoiding a Perl i/o bug on some platforms
( http://rt.perl.org/rt3//Public/Bug/Display.html?id=39060 ,
SA Bug 5985), while also providing a little speedup (10..25%)
on reading a message.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #8 from Justin Mason <jm...@jmason.org>  2008-10-08 01:37:24 PST ---
(In reply to comment #7)
> Committed revision 702559:
>   Bug 5985: avoid Perl I/O bug by replacing line-by-line reading
>   with read() where suitable, or play down the EBADF status in
>   other places and only report it as dbg instead of a die.
>   Also localized a couple of file handles where I came across them.

will that fix Daryl's bug, do you think?

(asking because I think I may be running into it sporadically -- although I
haven't been able to spot a mass-check where it's occurred for me recently.)


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985


Daryl C. W. O'Shea <sp...@dostech.ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spamassassin@dostech.ca
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




--- Comment #4 from Daryl C. W. O'Shea <sp...@dostech.ca>  2008-10-01 19:37:24 PST ---
Looks like M::SA::AI has the same issue in a few spots.

status:  14% ham: 11     spam: 465    date: 2008-08-04   now: 2008-10-01
05:11:00
status:  15% ham: 12     spam: 498    date: 2008-08-04   now: 2008-10-01
05:11:01
error reading: Bad file descriptor at
/home/dos/sa-mass-check/nightly_mass_check/masses/../blib/lib/Mail/SpamAssassin/ArchiveIterator.pm
line 380, <INPUT> line 2783.


There are probably other areas where the same thing is done (sa-learn perhaps).


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] Client.pm - 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985


Mark Martinec <Ma...@ijs.si> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #14 from Mark Martinec <Ma...@ijs.si>  2009-08-04 08:17:24 PST ---
> Btw, is there any test for this module? Wouldn't hurt.

Replying to myself: yes there is, it's the spamd_client.t,
and it passes all the tests on my host (perl 5.10.0).
Closing.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] Client.pm - 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985


Justin Mason <jm...@jmason.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|'message: error reading:    |Client.pm - 'message: error
                   |Bad file descriptor at      |reading: Bad file
                   |lib/Mail/SpamAssassin/Messa |descriptor at
                   |ge/Node.pm line 279'        |lib/Mail/SpamAssassin/Messa
                   |                            |ge/Node.pm line 279'




-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] Client.pm - 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #12 from Mark Martinec <Ma...@ijs.si>  2009-06-30 16:16:36 PST ---
> Yes, this fixed the issue I was having.  Thanks Mark!
> 
> I'll leave this open since there's still Client.pm to take care of.

Ok, I'll deal with it after the alpha release.

Btw, few weeks ago I got a report that the Perl I/O bug
is finally fixed in version 10, so the fix will probably
appear with the next Perl release.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #10 from Justin Mason <jm...@jmason.org>  2008-10-08 03:38:58 PST ---
(In reply to comment #9)
> > (asking because I think I may be running into it sporadically -- although I
> > haven't been able to spot a mass-check where it's occurred for me recently.)
> 
> Still after my yesterday's check-in?

no, it was at least a week ago.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985


Justin Mason <jm...@jmason.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #1 from Justin Mason <jm...@jmason.org>  2008-09-23 03:22:44 PST ---
fine on Solaris x86 with perl 5.8.6.
fine on MacOS X with perl 5.8.8.
bug happens with Linux (Ubuntu gutsy), perl 5.8.8.
bug happens with Linux (Ubuntu hardy 8.04.1), perl 5.8.8.

looks like a platform-specific perl bug. I also can't repro it with this test
script: http://taint.org/x/2008/bug5985scr , despite the "strace" output
looking pretty similar.

This is a hacky workaround, checking eof() if an error condition is indicated:

: jm 65...; svn commit -m "bug 5985: avoid spurious 'message: error reading:
Bad file descriptor' error during normal use" lib
Sending        lib/Mail/SpamAssassin/Message/Node.pm
Transmitting file data .
Committed revision 698119.

However, maybe we should just skip the error check entirely; this workaround
adds an additional read() syscall that is unnecessary, and may just hide "real"
bugs anyway, since hte doco says that eof() returns 1 if the FH is not open,
too.

feel free to try to find a better fix... ;)


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] Client.pm - 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #13 from Mark Martinec <Ma...@ijs.si>  2009-07-10 17:42:31 PST ---
> > I'll leave this open since there's still Client.pm to take care of.
> Ok, I'll deal with it after the alpha release.

  Bug 5985 - Client.pm: deal gracefully with a Perl I/O bug which may
  return status EBADF at eof; add: use strict; use warnings; use re 'taint'
Sending        lib/Mail/SpamAssassin/Client.pm
Committed revision 793156 ( https://svn.apache.org/viewcvs.cgi?view=rev&rev=793156 ).


Btw, is there any test for this module? Wouldn't hurt.

-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #11 from Daryl C. W. O'Shea <sp...@dostech.ca>  2008-10-09 15:28:58 PST ---
(In reply to comment #8)
> will that fix Daryl's bug, do you think?

Yes, this fixed the issue I was having.  Thanks Mark!

I'll leave this open since there's still Client.pm to take care of.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #2 from Mark Martinec <Ma...@ijs.si>  2008-09-23 06:20:43 PST ---
> fine on Solaris x86 with perl 5.8.6.
> fine on MacOS X with perl 5.8.8.
> bug happens with Linux (Ubuntu gutsy), perl 5.8.8.
> bug happens with Linux (Ubuntu hardy 8.04.1), perl 5.8.8.
> 
> looks like a platform-specific perl bug. I also can't repro it with this test
> script: http://taint.org/x/2008/bug5985scr , despite the "strace" output
> looking pretty similar.

A Perl bug on Linux, see:

  http://rt.perl.org/rt3//Public/Bug/Display.html?id=39060

Some Linux distributions set env. var. PERLIO="stdio".
Dropping it (unset PERLIO, or setting it to "") avoids the bug.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #5 from Mark Martinec <Ma...@ijs.si>  2008-10-02 01:47:42 PST ---
> lib/Mail/SpamAssassin/ArchiveIterator.pm line 380, <INPUT> line 2783.
> There are probably other areas where the same thing is done (sa-learn perhaps).

Do you have the environment variable PERLIO explicitly set?
To a non-default perl setting? If yes, could you please unset it
and see if ArchiveIterator.pm still hits that perl bug.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #6 from Daryl C. W. O'Shea <sp...@dostech.ca>  2008-10-06 13:51:07 PST ---
No, I do not.  Stock Fedora Core 6 Perl 5.8.8.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

[Bug 5985] 'message: error reading: Bad file descriptor at lib/Mail/SpamAssassin/Message/Node.pm line 279'

Posted by bu...@bugzilla.spamassassin.org.
https://issues.apache.org/SpamAssassin/show_bug.cgi?id=5985





--- Comment #7 from Mark Martinec <Ma...@ijs.si>  2008-10-07 10:51:45 PST ---
Committed revision 702559:
  Bug 5985: avoid Perl I/O bug by replacing line-by-line reading
  with read() where suitable, or play down the EBADF status in
  other places and only report it as dbg instead of a die.
  Also localized a couple of file handles where I came across them.


-- 
Configure bugmail: https://issues.apache.org/SpamAssassin/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.