Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] 1.3 on OS X - no dice so far

Hi both,

I think the well known phrase "release in haste, fix bugs at your
leisure" applies here! Thanks for the quick report, I would've
pestered someone on irc to give it a test on a mac but the driving
force was to get something out before the interop test day.

Having had a look, I can remember rewriting what turns into an endless
loop here to do it properly. No idea where that went!

The underlying cause though is that the socket code is failing
somewhere. Could you apply the attached patch and paste some of what
it prints out back here please?

Thanks,

Roger


On Mon, Mar 17, 2014 at 8:14 AM, Jan-Piet Mens <jpmens@xxxxxxxxx> wrote:
>> I can run mosquitto itself and it starts listening. Running either of the
>> clients mosquitto_pub or mosquitto_sub fails, they appear to hang, and the
>> broker never receives any connection. I also cannot use them to connect to
>> any other broker, local or otherwise.
>
> ACK.
>
> For the record, mosquitto_[ps]ub 1.2.3 work fine with the 1.3 broker.
>
> I can't look into this deeply now, but sub_client.c hangs upon entering
> mosquitto_connect_bind(); specifically in lib/mosquitto.c it doesn't get
> past _mosquitto_socketpair().
>
> If I add a printf() just before the
>
>         if(bind(listensock, (struct sockaddr *)&ss, sizeof(ss)) == -1){
>
> in lib/net_mosq.c, I see the client goes into an endless loop.
>
>         -JP
>
>
> _______________________________________________
> mosquitto-dev mailing list
> mosquitto-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/mosquitto-dev
diff -r 51d0fbc17b57 lib/net_mosq.c
--- a/lib/net_mosq.c	Sun Mar 16 23:52:51 2014 +0000
+++ b/lib/net_mosq.c	Mon Mar 17 09:02:43 2014 +0000
@@ -1048,22 +1048,26 @@
 		setsockopt(listensock, IPPROTO_IPV6, IPV6_V6ONLY, &ss_opt, sizeof(ss_opt));
 
 		if(bind(listensock, (struct sockaddr *)&ss, sizeof(ss)) == -1){
+			printf("bind: %d %s\n", errno, strerror(errno));
 			COMPAT_CLOSE(listensock);
 			continue;
 		}
 
 		if(listen(listensock, 1) == -1){
+			printf("listen: %d %s\n", errno, strerror(errno));
 			COMPAT_CLOSE(listensock);
 			continue;
 		}
 		memset(&ss, 0, sizeof(ss));
 		ss_len = sizeof(ss);
 		if(getsockname(listensock, (struct sockaddr *)&ss, &ss_len) < 0){
+			printf("getsockname: %d %s\n", errno, strerror(errno));
 			COMPAT_CLOSE(listensock);
 			continue;
 		}
 		
 		if(_mosquitto_socket_nonblock(listensock)){
+			printf("nonblock1: %d %s\n", errno, strerror(errno));
 			continue;
 		}
 
@@ -1077,10 +1081,12 @@
 
 		spR = socket(family, SOCK_STREAM, IPPROTO_TCP);
 		if(spR == -1){
+			printf("socket: %d %s\n", errno, strerror(errno));
 			COMPAT_CLOSE(listensock);
 			continue;
 		}
 		if(_mosquitto_socket_nonblock(spR)){
+			printf("nonblock2: %d %s\n", errno, strerror(errno));
 			COMPAT_CLOSE(listensock);
 			continue;
 		}
@@ -1089,6 +1095,7 @@
 			errno = WSAGetLastError();
 #endif
 			if(errno != EINPROGRESS && errno != COMPAT_EWOULDBLOCK){
+				printf("connect1: %d %s\n", errno, strerror(errno));
 				COMPAT_CLOSE(spR);
 				COMPAT_CLOSE(listensock);
 				continue;
@@ -1100,6 +1107,7 @@
 			errno = WSAGetLastError();
 #endif
 			if(errno != EINPROGRESS && errno != COMPAT_EWOULDBLOCK){
+				printf("accept: %d %s\n", errno, strerror(errno));
 				COMPAT_CLOSE(spR);
 				COMPAT_CLOSE(listensock);
 				continue;
@@ -1107,6 +1115,7 @@
 		}
 
 		if(_mosquitto_socket_nonblock(spW)){
+			printf("nonblock3: %d %s\n", errno, strerror(errno));
 			COMPAT_CLOSE(spR);
 			COMPAT_CLOSE(listensock);
 			continue;

Back to the top