New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session is false why can not receive offline messages #1081

Closed
dwin-wangjt opened this Issue Dec 14, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@dwin-wangjt
Copy link

dwin-wangjt commented Dec 14, 2018

No description provided.

@ralight ralight added the question label Dec 18, 2018

@ralight

This comment has been minimized.

Copy link
Contributor

ralight commented Dec 18, 2018

There are a few possibilities:

  • You haven't used the same client id for all connections
  • You haven't subscribed with QoS > 0
  • No messages were published on the topics you subscribe to, and had QoS > 0
  • You have the broker configured with persistence false (the default) and you restarted the broker
@alflexRH

This comment has been minimized.

Copy link

alflexRH commented Jan 25, 2019

I am in the process of debugging a similar issue.
my publish command: mosquitto_pub -t 'test' -m 'test' -q 2
my subscribe command: mosquitto_sub -t 'test' -q 2 -c -i testing

my sequence:

  1. start subscriber
  2. publish
    -- message arrives
  3. kill subscriber
  4. publish again
  5. start subscriber again
    -- i now expect a message, but there is nothing.

server is configured with 'persistence true'

sub,pub and server version is 1.5.5 on Debian.

@karlp

This comment has been minimized.

Copy link
Contributor

karlp commented Jan 25, 2019

works here.

karlp@strem:~$ mosquitto_sub -t 'test' -q 2 -c -i testing
^Z
[1]+  Stopped                 mosquitto_sub -t 'test' -q 2 -c -i testing
karlp@strem:~$ bg
[1]+ mosquitto_sub -t 'test' -q 2 -c -i testing &
karlp@strem:~$ 
karlp@strem:~$ 
karlp@strem:~$ mosquitto_pub -t 'test' -m 'test' -q 2
test
karlp@strem:~$ mosquitto_pub -t 'test' -m 'test' -q 2
test
karlp@strem:~$ fg
mosquitto_sub -t 'test' -q 2 -c -i testing
^C
(subscriber now offline)
karlp@strem:~$ mosquitto_pub -t 'test' -m 'test2' -q 2
karlp@strem:~$ mosquitto_pub -t 'test' -m 'test3' -q 2
karlp@strem:~$ mosquitto_pub -t 'test' -m 'test4' -q 2
( publish three more messages)
karlp@strem:~$ mosquitto_sub -t 'test' -q 2 -c -i testing &
[1] 26426
test2
test3
test4
karlp@strem:~$
( all messages received)

This is independent of persistence, that just determines whether stored messages persist across broker restarts

@alflexRH

This comment has been minimized.

Copy link

alflexRH commented Jan 28, 2019

Thanks for testing. it convinced me it was a config-related error so i kept trying, and i found something: it happens when i set per_listener_settings to true.
this is my config:

per_listener_settings true
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
listener 1883 127.0.0.1
protocol mqtt
max_connections 10
allow_anonymous true

If i set the per_listener_settings to false, it works as expected. may be there is another settings, apart from the listed ones: password_file, acl_file, psk_file, allow_anonymous, allow_zero_length_clientid, auth_plugin, auth_opt_*, auto_id_prefix, that is at play here?

@ralight

This comment has been minimized.

Copy link
Contributor

ralight commented Feb 5, 2019

Thanks for the follow up details, I can confirm that this was a bug and I've fixed it in my local branch will be part of 1.5.6 soon.

@ralight ralight added bug mosquitto-broker and removed question labels Feb 5, 2019

@ralight ralight closed this in f952ae3 Feb 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment