eclipse/paho.mqtt.c

update log or doc

vruge opened this issue · 3 comments

Is your feature request related to a problem? Please describe.

In some networks we get

19700101 000000.000 Return code 1 from poll
19700101 000000.000 m->c->connect_state = 1
19700101 000000.000 Removed socket 3
19700101 000000.000 Removed socket 3
19700101 000000.000 Connect failed, more to try

for the similar setup (device/software). Unfortunately, I do not know what is e.g. behind Return code 1 from poll.
It's a timeout or something else? What does -1 mean here?

(full og)
=========================================================
                   Trace Output
Product name: Eclipse Paho Asynchronous MQTT C Client Library
Version: 1.3.11
Build level: 2022-12-21T09:40:14Z
OpenSSL version: OpenSSL 1.1.1u  30 May 2023
OpenSSL flags: compiler: arm-pxc-linux-gnueabi-gcc  -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fstack-protector-strong  -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=                      -fdebug-prefix-map=                      -fdebug-prefix-map=                      -fdebug-prefix-map=  -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_A
OpenSSL build timestamp: built on: Tue May 30 12:42:39 2023 UTC
OpenSSL platform: platform: linux-armv4
OpenSSL directory: OPENSSLDIR: "/usr/lib/ssl-1.1"
/proc/version: Linux version 5.4.193-rt74-pxc (oe-user@oe-host) (gcc version 11.3.0 (GCC)) #1 SMP PREEMPT_RT Wed Nov 30 11:53:25 UTC 2022

=========================================================
19700101 000000.000 0 commands restored for client clientIDdummy
19700101 000000.000 0 queued messages restored for client clientIDdummy
19700101 000000.000 Connecting to serverURI private.broker.url:8883 with MQTT version 4
19700101 000000.000 New socket 3 for private.broker.url:8883, port 8883
19700101 000000.000 Connect pending
19700101 000000.000 Return code 1 from poll
19700101 000000.000 m->c->connect_state = 1
19700101 000000.000 Removed socket 3
19700101 000000.000 Removed socket 3
19700101 000000.000 Connect failed, more to try
19700101 000000.000 Could not find client corresponding to socket 3
19700101 000000.000 Connecting to serverURI private.broker.url:8883 with MQTT version 3
19700101 000000.000 New socket 3 for private.broker.url:8883, port 8883
19700101 000000.000 Connect pending
19700101 000000.000 Return code 1 from poll
19700101 000000.000 m->c->connect_state = 1
19700101 000000.000 Removed socket 3
19700101 000000.000 Removed socket 3
19700101 000000.000 0 inflight messages deleted for client clientIDdummy
20231215 133327.052 0 responses removed for client clientIDdummy
20231215 133327.052 Calling connect failure for client clientIDdummy
20231215 133327.052 Could not find client corresponding to socket 3

Describe the solution you'd like
Add addtional information for e.g.

Return code 1 from poll. Possible reason <timeout>, <unknown>, <not be reached broker>, <broker does not answer>

Describe alternatives you've considered
Return code 1 from poll. I don't find any docs about the massage. Alternative I would also be happy about docs here.

state

m->c->connect_state = 1 

mean TCP connection in progress
https://github.com/eclipse/paho.mqtt.c/blob/master/src/Clients.h#L103C9-L103C24

poll

Return code 1 from poll

is from

Log(TRACE_MAX, -1, "Return code %d from poll", *rc);

and related to line

/* Check pending write set for writeable sockets. */

more to try

Connect failed, more to try
related to line

Log(TRACE_MIN, -1, "Connect failed, more to try");

This behavior surprise, because we call c-Api from cpp-Api with

set_mqtt_version(4) 
// MQTTVERSION_3_1_1 (4) = only try version 3.1.1

from the documentation I don't accept a fallback.

Return code 1 from poll

is not a timeout. That's all I can say about it.
https://man7.org/linux/man-pages/man2/poll.2.html

It's meant for debugging. It's the return value from the poll() system call, which is described in the link you included:

   On success, poll() returns a nonnegative value which is the
   number of elements in the pollfds whose revents fields have been
   set to a nonzero value (indicating an event or an error).  

So it just means something has happened on one socket, and the program has to look further to determine what.