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 2016/12/05 15:13:48 UTC

[Bug 7380] New: isa method called on undef, causing spamassassin child process to die

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7380

            Bug ID: 7380
           Summary: isa method called on undef, causing spamassassin child
                    process to die
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: spamc/spamd
          Assignee: dev@spamassassin.apache.org
          Reporter: aduitsis@douitsis.com
  Target Milestone: Undefined

Spamd:accept_from_any_server_socket tries to check whether the $client variable
is true in order to emit an error in case it is undef. In the case where it is
undef, the code tries to die with a helpful error message. That's
understandable.

Unfortunately, it seems that in many cases where the $client variable is undef,
the $socket variable is also undef, so trying to call isa on it fails. So the
die never gets executed and, oddly enough, the code dies anyway at that very
line. Here is the offending line:

  $client or die sprintf("accept_a_conn: %s accept failed: %s",
                         ref $socket,
                         !$socket->isa('IO::Socket::SSL') ? $!
                           : $socket->errstr.", $!");

The error messsage emitted:

spamd[28754]: spamd: error: Can't call method "isa" on an undefined value at
/usr/local/bin/spamd line 1535
spamd[28754]: Software caused connection abort, continuing at
/usr/local/bin/spamd line 1396. This means the child dies and 
spamd[28743]: prefork: ordered child 28754 to accept, but they reported state
'1', killing rogue at

I would speculate this is not expected behaviour. Furthermore, accept_a_conn,
which is the caller of accept_from_any_server_socket does a check of its own:

($client, $socket_info) = accept_from_any_server_socket($timeout);
....
if ( !$client  || !defined $client->connected() ) {
.....

So even if client is undef, that condition is properly detected and handled.
Obviously, since the child dies inside accept_from_any_server_socket, the code
that checks $client in accept_a_conn never gets an undef $client.

I tried commenting out the "$client or die sprintf..." line above and the
children stopped dying abruptly.

The same error had been reported in bug #7184, but I think the diagnosis above
paints a more complete picture.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7380] isa method called on undef, causing spamassassin child process to die

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

Giovanni Bechis <gi...@paclan.it> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |giovanni@paclan.it

--- Comment #1 from Giovanni Bechis <gi...@paclan.it> ---
Created attachment 5480
  --> https://bz.apache.org/SpamAssassin/attachment.cgi?id=5480&action=edit
check for $socket

Check if $socket is defined and print error accordingly

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7380] isa method called on undef, causing spamassassin child process to die

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

Giovanni Bechis <gi...@paclan.it> changed:

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

--- Comment #2 from Giovanni Bechis <gi...@paclan.it> ---
Fixed in r1825031.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 7380] isa method called on undef, causing spamassassin child process to die

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

Athanasios Douitsis <ad...@douitsis.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aduitsis@douitsis.com

--- Comment #3 from Athanasios Douitsis <ad...@douitsis.com> ---
Many thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.