Skip to content
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

Negative 08-ssl-connect-cert-auth*.py tests fail because of exception race under high load #3208

Open
narc-Ontakac2 opened this issue Jan 29, 2025 · 2 comments
Labels
Component: mosquitto-broker Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer.
Milestone

Comments

@narc-Ontakac2
Copy link
Contributor

narc-Ontakac2 commented Jan 29, 2025

If you create high load with something like stress -c 16 -i 4 the negative 08-ssl-connect-cert-auth*.py tests often fail because the IO error 104 outruns the SSL error:

./08-ssl-connect-cert-auth-expired.py
1737794412: The 'port' option is now deprecated and will be removed in a future
version. Please use 'listener' instead.
1737794412: mosquitto version 2.0.20 starting
1737794412: Config loaded from 08-ssl-connect-cert-auth-expired.conf.
1737794412: Opening ipv4 listen socket on port 1888.
1737794412: Opening ipv6 listen socket on port 1888.
1737794412: Opening ipv4 listen socket on port 1889.
1737794412: Opening ipv6 listen socket on port 1889.
1737794412: mosquitto version 2.0.20 running
1737794413: New connection from ::1:46892 on port 1889.
1737794413: Client <unknown> closed its connection.
1737794413: New connection from 127.0.0.1:57692 on port 1888.
1737794413: OpenSSL Error[0]: error:0A000086:SSL routines::certificate verify
failed
1737794413: Client <unknown> disconnected: Protocol error.
1737794413: mosquitto version 2.0.20 terminating

Traceback (most recent call last):
  File "/tmp/autopkgtest.VIjXET/build.jf2/src/test/broker/./08-ssl-connect-
cert-auth-expired.py", line 40, in <module>
    mosq_test.do_send_receive(ssock, connect_packet, "", "connack")
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/autopkgtest.VIjXET/build.jf2/src/test/mosq_test.py", line 136, in
do_send_receive
    sent = sock.send(send_packet[total_sent:])
  File "/usr/lib/python3.13/ssl.py", line 1232, in send
    return self._sslobj.write(data)
           ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer
make: *** [Makefile:154: 08] Error 1

I am still unsure where the race takes place, this might be a python issue. It might however also be a mosquitto server issue, which would make it more serious.

Any opinions on that are appreciated.

See also Debian bug #1094157.

@github-actions github-actions bot added the Status: Available No one has claimed responsibility for resolving this issue. label Jan 29, 2025
ralight added a commit that referenced this issue Jan 30, 2025
Occurs when run under load. Thanks to Joachim Zobel.

Closes #3208.
@ralight ralight added Component: mosquitto-broker Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer. and removed Status: Available No one has claimed responsibility for resolving this issue. labels Jan 30, 2025
@ralight ralight added this to the 2.0.21 milestone Jan 30, 2025
@ralight
Copy link
Contributor

ralight commented Jan 30, 2025

Thanks for this. It's not a concern in itself. What's happening is we try and send a CONNECT packet. If that happens before the socket is closed then no exception is raised, if the socket is closed already because of the load then it produces this error. It's perfectly valid though. I've pushed a fix for the two tests where I could reproduce it. If you still get other failures can you please attach the logs for them?

@narc-Ontakac2
Copy link
Contributor Author

If it not a mosquitto server issue I can simply fix it by also catching the errno 104 IO exception. You'll get a pull request within about a week. I didn't do this yet because I did not want to hide a potentially serious bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: mosquitto-broker Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer.
Projects
None yet
Development

No branches or pull requests

2 participants