Segfault on $SYS subscription

Bug #530099 reported by andypiper on 2010-03-01
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

Start mosquitto.

Start a client (ia92 for example)

Subscribe to topic $SYS/

-> Segfault

Roger Light (roger.light) wrote :

What is the expected behaviour when subscribing to a topic with a trailing / ?

(I realise that a segfault certainly isn't the expected behaviour)

andypiper (andypiperuk) wrote :

No idea. But it also crashes if you subscribe to $SYS/#

Andy Stanford-Clark (andysc) wrote :

It should be like with a URL... the same. So subscribe to "a/" is the same as subscribe to "a".

It should be clear, though, that subscribe to "a#" is not the same as to "a/#" (the first is an invalid subscription specification, the second is fine)

Roger Light (roger.light) wrote :

That it crashes on subscribing to $SYS/# surprises me, I use this as my default topic for checking that something is happening.

I presume that it crashes just the same with mosquitto_sub?

Does it crash on subscribing to other topics?

Changed in mosquitto:
status: New → Fix Committed
Changed in mosquitto:
status: Fix Committed → Fix Released
Roger Light (roger.light) wrote :

If you get a chance, could you confirm that this is fixed for you now please? I could replicate crashing on $SYS/ but not on $SYS/#

andypiper (andypiperuk) wrote :

Interesting. Works now (sort of) with IA92 Java client, but mosquitto_sub -t $SYS/ (or $SYS/#) returns immediately with mosquitto itself having crashed.

The first time I subscribe on $SYS/# in the Java app I get a null index exception, then it works. Could be a bug in the client though.

Incidentally I noticed that when I subscribed in the Java app to $SYS/# I saw a topic of $SYS/broker/clients/total (undocumented in the man page) which lists "19" - is that historical?

Roger Light (roger.light) wrote :

Ah! If you use mosquitto_sub, you'll need to escape the $ sign otherwise it gets expanded as an (empty) environment variable. So $SYS/# becomes /#. Obviously that's still a problem which I'll look into later.

$SYS/broker/clients/total should be in the man page. It actually counts all of the clients that are currently connected, or those that were connected with clean start disabled. I need to split that data up a bit.

Do you mean anything specific by "sort of"?

andypiper (andypiperuk) wrote :

"$SYS/broker/clients/total should be in the man page" - indeed :-) it isn't there though.
Ah ok the clean start thing explains why it shows 19 for me then!

And doh, of course, it's expanding the shell env var *blush* I knew that...

By "sort of" I mean that at the moment the Java client reports a null index message on connecting and then appears to work... no time to check where that lies right now though.

Roger Light (roger.light) wrote :

This should be fixed for definite in 0.5.3, as well as some other cases that could have caused problems.

If you still have the "sort of" problem, could you open a new bug report please?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers