[PD] tcpserver crashes on the 34th client connection

Martin Peach martin.peach at sympatico.ca
Sun May 19 03:17:54 CEST 2013


Yes, it seems that the routine that adds new connections doesn't check 
to see if it has passed the number of connection slots.
There are MAX_CONNECT slots allocated when [tcpserver] starts.

Thanks for finding this bug!

There is no reason to limit the number of connections to 32 except to 
not use up memory.
I think it could be changed to either dynamically add space for new 
connections without limit or set MAX_CONNECT with a creation argument.

For now you could recompile it with MAX_CONNECT set to another value. 
(At some point the OS will run out of sockets. Before that Pd will slow 
down...)

#define MAX_CONNECT 10000


Martin

On 2013-05-18 17:37, Antoine Villeret wrote:
> so I reply to myself...
>
> I found this in the code of both tcpserver.c :
> #define MAX_CONNECT 32 /* maximum number of connections */
>
> which could be an answer embryo
>
> so, I shouldn't make more than 32 connections on the same tcpserver, ok,
> but why ?
> is there a good reason to fix this to 32 ?
>
> and this doesn't tell me why it crashes...
> reaching the MAX_CONNECT should handles in the code isn't it ?
>
> cheers
>
> a
>
> --
> do it yourself
> http://antoine.villeret.free.fr
>
>
> 2013/5/16 Antoine Villeret <antoine.villeret at gmail.com
> <mailto:antoine.villeret at gmail.com>>
>
>     hi all,
>
>     I've just notice [tcpserver] crashes when the 34th client try to connect
>     both iemnet and mrpeach are affected
>
>     iemnet version send a strange number on the 33th connection
>     (like 2.8686e+07) and crashes on the 34th
>
>
>     here is a gdb output for iem :
>     Program received signal SIGSEGV, Segmentation fault.
>     0x00007fffcdbca746 in tcpserver_connectpoll (x=0x66994c0) at
>     tcpserver.c:503
>     503     x->x_sr[i] = y;
>     (gdb) watchdog: signaling pd...
>
>
>     and for mrpeach :
>     Program received signal SIGSEGV, Segmentation fault.
>     0x00007fffcddaf585 in tcpserver_connectpoll (x=0xadfc1c0) at
>     tcpserver.c:1113
>     1113       outlet_float(x->x_sockout, x->x_sr[i]->sr_fd);/* the
>     socket number */
>     (gdb) watchdog: signaling pd...
>
>
>     it happens on ubuntu 12.04 64 bit
>     pd 0.44.2
>     and SVN update today
>
>     i'm certainly doing something wrong to get this (like keeping
>     clients connected all the time)
>     but a crash is never welcome...
>
>     cheers
>
>     antoine
>     --
>     do it yourself
>     http://antoine.villeret.free.fr
>
>
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>




More information about the Pd-list mailing list