On 9 September 2014 23:04, Theodor-Iulian Ciobanu <theo...@gmail.com> wrote:
> On Tue, 9 Sep 2014 08:18:01 +0100
> Matthew Wild <mwi...@gmail.com> wrote:
>
>> Hi Theo,
>>
>> On 9 September 2014 07:45, Theodor-Iulian Ciobanu <theo...@gmail.com>
>> wrote:
>> > Hello,
>> >
>> > I've recently moved from CentOS to FreeBSD and am having issues
>> > starting prosody with use_libevent=true. I'm using luajit-2.0.3
>> > (same behavior with lua5.1 though), libevent2-2.0.21_2 and master
>> > of luaevent (there isn't a port for it, so I thought of going with
>> > the latest if I'm compiling it anyway).
>>
>> I know of an issue with FreeBSD + libevent that occurs when Prosody is
>> set to daemonize itself, however I thought that issue manifested
>> itself differently. Could you try daemonize = false in (the global
>> section of) your config file, and see if this is that same issue?
>
> As almost always the case in such events, as soon as I hit Send on my 
> previous mail I found this workaround as well:
>
> http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2014-April/275346.html
>
> And by setting daemonize=false and having the rc script take care of it 
> instead I was able to start prosody.

Ok, thanks for the confirmation!

> My next question would be if this is an issue with lib/luaevent on fbsd 
> (though I was able to run the luaevent client+server test successfully) or 
> with prosody itself, because I'd be more than happy to help debug and fix 
> this if the latter case. I tried adding more debug info to server_event.lua 
> to check if there was a silent failure when registering events, but that 
> didn't seem the case; and it's also where my knowledge of libevent sort of 
> stops, so I don't know where to go to next.

It's a problem with kqueue and the way Prosody starts. Prosody
initializes its networking before it loads any modules. The code that
daemonizes is in mod_posix, so it runs after networking has been
initialized. Unfortunately when daemonizing, kqueue doesn't carry its
state across to the new process.

The workaround for this on the Prosody side would be to daemonize
before doing absolutely anything else. It sort of makes sense, even if
we lose a bit of flexibility, so I'm considering this for a future
version.

I don't know if there is anything that can be done in libevent to work
around this, I haven't checked since originally investigating the
issue. Other backends (e.g. epoll) work fine.

Regards,
Matthew

-- 
You received this message because you are subscribed to the Google Groups 
"prosody-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to prosody-dev+unsubscr...@googlegroups.com.
To post to this group, send email to prosody-dev@googlegroups.com.
Visit this group at http://groups.google.com/group/prosody-dev.
For more options, visit https://groups.google.com/d/optout.

Reply via email to