SCTP Discussions

Text archives Help


Re: [SCTP-Discussion] a weird bug (segmentation fault)


Chronological Thread 
  • From: "Julio Kriger" <juliokriger AT gmail.com>
  • To: "Thomas Dreibholz" <dreibh AT iem.uni-due.de>
  • Cc: discussion AT sctp.de
  • Subject: Re: [SCTP-Discussion] a weird bug (segmentation fault)
  • Date: Tue May 23 14:42:03 2006
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=lgDusbKa4wQ19b57b52oH4gIKK+hSI/dlNkbfhti5obioVVf6Nc2p9iK9Hwaw0CYHO9ohwdp8Np12ckF2ihmrlhMSEp/S3WRSM8CeNG7O18fFKr/04xWkw5/ydQmBHsKIekSjXut3N+2W6RTzKctD+PjFz12SbaAWsMl/JssdsU=
  • List-id: SCTP Discussions <discussion.sctp.de>

Hi!
  I didn't knew that the library is not thread safe.
  So to fix my app, I should put a mutex before where the calling of "sctp_*" functions (for example put a mutex before SCTP_receive, SCTP_send, ect) ? and what about SCTP_startTimer? should I put a mutex before calling that function?
  Well, let say that I should put a mutex before calling any function from the SCTP library. That should fix the thread-safe problem.
  Regards,
Julio
 


On 5/23/06, Thomas Dreibholz <dreibh AT iem.uni-due.de> wrote:
On Monday 22 May 2006 02:33, Julio Kriger wrote:
> Hi!
> I have program that launch 4 threads, each thread open a SCTP connection to
> another PC. And a weird bug present (actually is a segmentation fault).
> Here is some code;
>
>     sctpInstance = SCTP_registerInstance(cp->sourcePort, inputStreams,
> outputStreams, noOfLocalAddresses, localAddressList, LLServerEchoUlp);
>
>         //sleep(5);
>
>         SCTP_associate(sctpInstance, outputStreams, destinationAddress,
> cp->destPort, clientParamIndex);
>
> If I don't put the "sleep", everyhing works good. But ...
>
> If I put the "sleep" for 10 seconds (on each thread) I get a core dump:

This looks like a thread-safety problem. Check whether your mutex locking is
okay. That is, do you call sctp_extendedEventLoop() with the correct locking
functions and do you obtain the mutex before you call any sctplib function?

The best recommendation when using multiple threads is to use the socket API
library. Unlike the sctplib, the socket API library is thread-safe. For
further details on how to get your sctplib programs thread-safe, you can also
have a look into the socket API sources, especially sctpsocketmaster.cc.


Best regards
--
=======================================================================
Dipl.-Inform. Thomas Dreibholz

University of Essen,                            Room ES210
Inst. for Experimental Mathematics              Ellernstraße 29
Computer Networking Technology Group            D-45326 Essen/Germany
-----------------------------------------------------------------------
E-Mail:     dreibh AT exp-math.uni-essen.de
Homepage:   http://www.exp-math.uni-essen.de/~dreibh
=======================================================================





--
--
Stewie: [After Lois tries to feed Stewie his broccoli "airplane style"] Damn you, Damn the Broccoli, and Damn the Wright Brothers.
----------------------------
Julio Kriger
mailto:juliokriger AT gmail.com



Archive powered by MHonArc 2.6.19+.

Top of page