Multiple simultaneous connections seg faults

Bug #801678 reported by Craig Hollabaugh
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mosquitto
Fix Released
Undecided
Unassigned

Bug Description

root@horton:~/keydbbridge# /usr/sbin/mosquitto -v
mosquitto version 0.11.1 (build date 2011-06-21 12:30:43+0000) starting

I'm using the PHP MQTT Client and can reliably crash the broker. Here's the log file, showing the problem.

Jun 24 11:36:35 horton mosquitto[25024]: New client connected from 127.0.0.1.
Jun 24 11:36:35 horton mosquitto[25024]: Received CONNECT from 127.0.0.1 as PHP MQTT Client
Jun 24 11:36:35 horton mosquitto[25024]: Sending CONNACK to PHP MQTT Client (0)
Jun 24 11:36:35 horton mosquitto[25024]: Received PUBLISH from PHP MQTT Client (d0, q0, r0, m0, 'us/co/montrose/121 Apollo/weather/temperature2F', ... (6 bytes))
Jun 24 11:36:35 horton mosquitto[25024]: Sending PUBLISH to python_sub (d0, q0, r0, m0, 'us/co/montrose/121 Apollo/weather/temperature2F', ... (6 bytes))
Jun 24 11:36:35 horton mosquitto[25024]: Received DISCONNECT from PHP MQTT Client
Jun 24 11:36:35 horton mosquitto[25024]: New client connected from 127.0.0.1.
Jun 24 11:36:35 horton mosquitto[25024]: New client connected from 127.0.0.1.
Jun 24 11:36:35 horton mosquitto[25024]: Received CONNECT from 127.0.0.1 as PHP MQTT Client
Jun 24 11:36:35 horton mosquitto[25024]: Sending CONNACK to PHP MQTT Client (0)
Jun 24 11:36:35 horton mosquitto[25024]: Client PHP MQTT Client already connected, closing old connection.
Jun 24 11:36:35 horton mosquitto[25024]: Received CONNECT from 127.0.0.1 as PHP MQTT Client
Jun 24 11:36:35 horton mosquitto[25024]: Sending CONNACK to PHP MQTT Client (0)
Jun 24 11:36:35 horton kernel: [1355952.129433] mosquitto[25024]: segfault at 10 ip 08051853 sp bfd5b850 error 4 in mosquitto[8048000+10000]

I'm publishing key/value pairs from php script on apache2.

            $mqtt = new phpMQTT("localhost", 1883, "PHP MQTT Client");
            if ($mqtt->connect()) {
                $mqtt->publish($_GET['key'],$_GET['value'],0);
                $mqtt->close();
            }

It looks like apache's threading is connecting with the same id and mosquitto is closing old connection incorrectly.

Jun 24 11:36:35 horton mosquitto[25024]: Client PHP MQTT Client already connected, closing old connection.

then I get the seg fault.

My workaround is randomizing the login id on the php side.

Revision history for this message
Roger Light (roger.light) wrote :

I'm quite certain this is effectively a duplicate of #799688 but with different symptoms.

Changed in mosquitto:
milestone: none → 0.11.2
status: New → Fix Released
Revision history for this message
Craig Hollabaugh (3-craig) wrote : Re: [Bug 801678] Re: Multiple simultaneous connections seg faults

Roger,
I compiled 0.11.2 and ran it for a while with my simultaneous php
connections using the same id 'php'. 0.11.2 dies with seg fault (took
about 30 minutes instead of 5 with 0.11.1)

New client connected from 127.0.0.1.
New client connected from 127.0.0.1.
Client php already connected, closing old connection.
Segmentation fault

What info do you want from me now?
Craig

On Sun, 2011-06-26 at 21:24 +0000, Roger Light wrote:
> ** Changed in: mosquitto
> Status: New => Fix Released
>
> ** Changed in: mosquitto
> Milestone: None => 0.11.2
>

Changed in mosquitto:
status: Fix Released → In Progress
Revision history for this message
Roger Light (roger.light) wrote :

Sorry for the delay getting back to you, I've been on honeymoon! That's also why I've not been quite so focused on the 0.11.x releases.

I've committed a fix which you can try out in the 0.11.3 branch at https://bitbucket.org/oojah/mosquitto/src/ef248ac736b4 if you wish.

Changed in mosquitto:
milestone: 0.11.2 → 0.11.3
status: In Progress → Fix Committed
Revision history for this message
Craig Hollabaugh (3-craig) wrote :
Download full text (3.1 KiB)

Hey hey, congrats!

Will run 11.3 and check for faults.

Roger Light <email address hidden> wrote:

>Sorry for the delay getting back to you, I've been on honeymoon! That's
>also why I've not been quite so focused on the 0.11.x releases.
>
>I've committed a fix which you can try out in the 0.11.3 branch at
>https://bitbucket.org/oojah/mosquitto/src/ef248ac736b4 if you wish.
>
>** Changed in: mosquitto
> Status: In Progress => Fix Committed
>
>** Changed in: mosquitto
> Milestone: 0.11.2 => 0.11.3
>
>--
>You received this bug notification because you are subscribed to the bug
>report.
>https://bugs.launchpad.net/bugs/801678
>
>Title:
> Multiple simultaneous connections seg faults
>
>Status in mosquitto: an mqtt message broker:
> Fix Committed
>
>Bug description:
> root@horton:~/keydbbridge# /usr/sbin/mosquitto -v
> mosquitto version 0.11.1 (build date 2011-06-21 12:30:43+0000) starting
>
> I'm using the PHP MQTT Client and can reliably crash the broker.
> Here's the log file, showing the problem.
>
>
> Jun 24 11:36:35 horton mosquitto[25024]: New client connected from 127.0.0.1.
> Jun 24 11:36:35 horton mosquitto[25024]: Received CONNECT from 127.0.0.1 as PHP MQTT Client
> Jun 24 11:36:35 horton mosquitto[25024]: Sending CONNACK to PHP MQTT Client (0)
> Jun 24 11:36:35 horton mosquitto[25024]: Received PUBLISH from PHP MQTT Client (d0, q0, r0, m0, 'us/co/montrose/121 Apollo/weather/temperature2F', ... (6 bytes))
> Jun 24 11:36:35 horton mosquitto[25024]: Sending PUBLISH to python_sub (d0, q0, r0, m0, 'us/co/montrose/121 Apollo/weather/temperature2F', ... (6 bytes))
> Jun 24 11:36:35 horton mosquitto[25024]: Received DISCONNECT from PHP MQTT Client
> Jun 24 11:36:35 horton mosquitto[25024]: New client connected from 127.0.0.1.
> Jun 24 11:36:35 horton mosquitto[25024]: New client connected from 127.0.0.1.
> Jun 24 11:36:35 horton mosquitto[25024]: Received CONNECT from 127.0.0.1 as PHP MQTT Client
> Jun 24 11:36:35 horton mosquitto[25024]: Sending CONNACK to PHP MQTT Client (0)
> Jun 24 11:36:35 horton mosquitto[25024]: Client PHP MQTT Client already connected, closing old connection.
> Jun 24 11:36:35 horton mosquitto[25024]: Received CONNECT from 127.0.0.1 as PHP MQTT Client
> Jun 24 11:36:35 horton mosquitto[25024]: Sending CONNACK to PHP MQTT Client (0)
> Jun 24 11:36:35 horton kernel: [1355952.129433] mosquitto[25024]: segfault at 10 ip 08051853 sp bfd5b850 error 4 in mosquitto[8048000+10000]
>
> I'm publishing key/value pairs from php script on apache2.
>
> $mqtt = new phpMQTT("localhost", 1883, "PHP MQTT Client");
> if ($mqtt->connect()) {
> $mqtt->publish($_GET['key'],$_GET['value'],0);
> $mqtt->close();
> }
>
>
> It looks like apache's threading is connecting with the same id and mosquitto is closing old connection incorrectly.
>
> Jun 24 11:36:35 horton mosquitto[25024]: Client PHP MQTT Client
> already connected, closing old connection.
>
> then I get the seg fault.
>
> My workaround is randomizing the login id on the php side.
>
>To manage notifications about this bug go to:
>https://bugs.launchpad.net/mosquitto/+bug/801678/...

Read more...

Revision history for this message
Craig Hollabaugh (3-craig) wrote :

Roger,
I've been running 0.11.3 for 3 days without my php hack mentioned above (meaning simultaneous logins with userid 'php'), no seg faults.

Please mark this as fixed.
Thanks!
Craig

Revision history for this message
Roger Light (roger.light) wrote :

Thanks very much for the feedback!

Changed in mosquitto:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.