From: Matthew Bloch on
Hello, I just got this backtrace and don't understand something about
it:

F, [2010-04-14T14:19:11.039347 #28597] FATAL -- : can't clone NilClass
(SystemExit)
/usr/lib/ruby/1.8/rexml/text.rb:311:in `recvfrom'
/usr/lib/mauvealert/lib/mauve/server.rb:158:in `receive_waiting_packets'
/usr/lib/mauvealert/lib/mauve/server.rb:104:in `run'
/usr/lib/mauvealert/lib/mauve/server.rb:91:in `loop'
/usr/lib/mauvealert/lib/mauve/server.rb:91:in `run'
/usr/lib/mauvealert/bin/mauveserver:32
/usr/lib/mauvealert/bin/mauveserver:30:in `loop'
/usr/lib/mauvealert/bin/mauveserver:30
/usr/lib/mauvealert/mauve_starter.rb:22:in `load'
/usr/lib/mauvealert/mauve_starter.rb:22

Rather, I understand the exception, the line in server.rb:158 is this:

packets = [@socket.recvfrom(65535)]

@socket is just a UDPServer socket, and I'm wanting to read raw data.
So I don't understand how the backtrace includes a call to REXML.

Another Thread in the program is processing XMPP messages, that's the
only code path that would use REXML, so I assume there is a bug in that
part of the code, somehow the backtrace pops out in another Thread, and
I've lost the original context.

I don't have Thread.abort_on_exception set.

Is this a backtrace that appears to "cross threads" or is there some
legitimate reason a socket I/O call could call REXML? This is on
Debian/lenny's ruby, 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux].

--
Matthew




From: Roger Pack on

> F, [2010-04-14T14:19:11.039347 #28597] FATAL -- : can't clone NilClass
> (SystemExit)
> /usr/lib/ruby/1.8/rexml/text.rb:311:in `recvfrom'
...
> Another Thread in the program is processing XMPP messages, that's the
> only code path that would use REXML, so I assume there is a bug in that
> part of the code, somehow the backtrace pops out in another Thread, and
> I've lost the original context.
>
> I don't have Thread.abort_on_exception set.
>
> Is this a backtrace that appears to "cross threads" or is there some
> legitimate reason a socket I/O call could call REXML? This is on
> Debian/lenny's ruby, 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux].

In Ruby, if the main thread exits "the whole program exits"
before "the whole program exits", though, it raises this exception on
each still running thread. Kind of like "get ready to die."
I think that's the way it is, anyway, and I'm pretty sure the program
still terminates if the threads rescue that exception, which makes me
wonder how that all works exactly, but HTH.
-rp
--
Posted via http://www.ruby-forum.com/.

From: Matthew Bloch on
On Fri, 2010-04-16 at 05:26 +0900, Roger Pack wrote:
> [snip]
>
> In Ruby, if the main thread exits "the whole program exits"
> before "the whole program exits", though, it raises this exception on
> each still running thread. Kind of like "get ready to die."
> I think that's the way it is, anyway, and I'm pretty sure the program
> still terminates if the threads rescue that exception, which makes me
> wonder how that all works exactly, but HTH.

Thanks, I will try some experiments to see if I can get it to behave
that way again.

--
Matthew