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: Sun May 28 05:12:02 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=XioFDQdlgnSXKJi8OZ3XYAWdOER6/4dEcqlDNaQXRXusLB3ksYIQNtN39Pr1eJnJM5xcHLHzANOcWr0yBerFwUYZPsLOlFaWYYFsqqGU0kCpQmqXorDkytWNkPyVeSRVSzAJm8POsN9OcU/Cqi27mOv4SK9ePC8bihMAVyzqr44=
  • List-id: SCTP Discussions <discussion.sctp.de>

Hi!
I made the app thread safe. Every call to the sctp library is done through a mutex. and I have another mutex for sctp_extendedEventLoop.  I tried to use only one mutex, but I stated to get locking problems. I hope this is correct.
Now many times I get a core dump, but it's of no use to read it with ddd or gdb, it pints to nowhere (I compiled sctplib with -ggdg option). And when I don't get the "holy" core dump I get this messages several times: "Bad ctsna arrived in SACK or no data in queue - discarding SACK".
I don't know what I'm doing wrong. Maybe I should use the socket api...
Feel free to share any thought about this.
Regards,
Julio


On 5/23/06, Julio Kriger <juliokriger AT gmail.com> wrote:
Hi Thomas,
  Thanks for the details. I never knew about "sctp_extendedEventLoop(lock
,unlock,mutex);". I will follow you advice.
  Regards,
Julio


On 5/23/06, Thomas Dreibholz <dreibh AT iem.uni-due.de> wrote:
On Tuesday 23 May 2006 14:38, Julio Kriger wrote:
> 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.

Yes, make sure that every sctplib function is called exclusively.

For the event loop, the following das to be done: define functions to obtain
and release the mutex and give a pointer to the mutex as third argument:

void lock(void* mutexPtr)
{
   mutex = (YourMutexPtrType*)mutexPtr;
   Lock it ...
}

void unlock(void* mutexPtr)
{
   mutex = (YourMutexPtrType*)mutexPtr;
   Unlock it ...
}

sctp_extendedEventLoop(lock,unlock,mutex);


Also have a look into the file sctpsocketmaster.cc of the socket API. It
implements the thread-safe event loop for the socket API library.


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



--
--
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