Segfault on $SYS subscription

Bug #530099 reported by andypiper
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mosquitto
Fix Released
Undecided
Unassigned

Bug Description

Start mosquitto.

Start a client (ia92 for example)

Subscribe to topic $SYS/

-> Segfault

Revision history for this message
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)

Revision history for this message
andypiper (andypiperuk) wrote :

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

Revision history for this message
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)

Revision history for this message
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
Revision history for this message
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/#

Revision history for this message
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?

Revision history for this message
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"?

Revision history for this message
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.

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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