eclipse-paho / eclipse-paho/paho.mqtt.java
a timeToWait value of -1 (i.e. wait forever) is not a good default
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 919
- PR merge metrics
- No merged PRs in 30d
Description
Please fill out the form below before submitting, thank you!
- [x] Bug exists Release Version 1.2.2 ( Master Branch)
- [ ] Bug exists in MQTTv3 Client on Snapshot Version 1.2.3-SNAPSHOT (Develop Branch)
- [ ] Bug exists in MQTTv5 Client on Snapshot Version 1.2.3-SNAPSHOT (Develop Branch)
If this is a bug regarding the Android Service, please raise the bug here instead: https://github.com/eclipse/paho.mqtt.android/issues/new
The default time to wait value: -1 . Is not a good default value. This occasionally leads clients to hang in the call to connect( ) indefinitely. 60000 milliseconds is a reasonable default and will avoid some "my connection is hung" bugs in the future. It won't affect users that are already calling setTimeToWait API, but there are quite a few applications that don't call the setTimeToWait API.
Code reference:
https://github.com/eclipse/paho.mqtt.java/blob/master/org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttClient.java#L64
Recommendation:
- Change from -1 to 60000
Contributor guide
Research direction
Open org.eclipse.paho.client.mqttv3/MqttClient.java at the referenced line and inspect the default timeToWait value used by connect(). Change the default from -1 to 60000 milliseconds, while preserving behavior for callers that use setTimeToWait; done means the default no longer waits forever.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100