Hi,
Actually this makes sense, when performing a read in 'pull mode' (the client default), the client sends a short request to the server for data, if this was sent at the same time as writing a command you would still get the corruptions.

So a simple rule of one thread accessing one client at a time should provide stable behaviour.

Toby

2008/12/17 Peter Nordin <Peter.Nordin@liu.se>
Ok! now I have also put my "writemutex" around the ReadIfWaiting part of
the code. And now it seems to work better.
So don't read and write from the same PlayerClient object at the same
time seems to be the key. Hopefully this fixed my problem for real, I
will just have to wait and see if it returns I guess.

Peter

Peter Nordin wrote:
>
> I have tried it now and sadly it did not solve my problem. When I was
> sending data from two threads through the same PlayerClient the crash
> would happen very fast, within 30 seconds. When creating a different
> PlayerClient for the opaque data it takes a lot longer before the
> crash occur. Sometimes a few minutes and sometimes up to 20 minutes.
> (I have not tried it that many times). The crash (or "message is
> larger than" warning) will happen eventually. I have tried using a
> mutex to lock before every write as well as using different
> PlacyrClients for the stuff that should be written.
>
> The opaque data I am sending has a size of 4380 byte. Is there any
> risk of the playerserver incoming message buffer not being large
> enough, so that messages overwrite each other under some kind of
> circumstances? I have tried to change the message size but the crash
> behavior seems to be the same regardless of message size. I have tried
> up to 4752060 bytes. And also very low values, around 200 bytes.
>
> Can any problems be expected when reading (ReadIfWating) and writing
> in different threads. Could it be dangerous to read and write at the
> same time?
>
> I am going to replace the opaque proxy with a normal position2d proxy
> and see if the problem remains. Of course I cant send the same kind of
> data. I just want to see what happens.
>
> Peter
>
> -----Original Message-----
> From: Peter Nordin [mailto:peter.nordin@liu.se]
> Sent: Mon 12/15/2008 9:48 PM
> To: playerstage-developers@lists.sourceforge.net
> Subject: RE: [Playerstage-developers] Player crash (sometimes)
> when     receiving opaque messages
>
> Ok, that sounds reasonable, thank you. I am going to try this tomorrow
> afternoon. Either by splitting it up into several different player
> clients or by adding a "write mutex" to prevent double writing. I will
> post my results after I have tried it.
>
> /Peter
>
>
> -----Original Message-----
> From: Toby Collett [mailto:tcollett+player@plan9.net.nz]
> Sent: Mon 12/15/2008 9:31 PM
> To: playerstage-developers@lists.sourceforge.net
> Subject: Re: [Playerstage-developers] Player crash (sometimes)
> when     receiving opaque messages
>
> In the past these sorts of errors have related to two threads sending
> commands through a single client at the same time. I suspect this is
> what is
> happening in your case. Basically the command data ends up interleaved on
> the socket and so player gets a corrupt header which then causes the
> rest of
> the problems. Possibly we should stick a checksum on the header to
> protect
> against this in the future...
>
> However to actually fix the problem you will either need seperate clients
> for each thread to to implement a locking mechanism so your client
> threads
> dont both send commands at the same time.
>
> Toby
>
> 2008/12/16 Peter Nordin <peter.nordin@liu.se>
>
> > I am not using boost enabled multithreading. But I am using my own
> threads
> > (pthread). In one of these threads the opaqueproxy send command is
> called.
> > The crash is happening at the server side. The playerserver crashes
> when it
> > receives an opaque message that has be corrupted or something. Right
> now
> > both client and server is running on the same computer. But if I run
> the
> > relay driver on another computer it is that computer that crashes
> instead.
> > So the player server receiving the faulty messages is the one that
> crashes.
> > It only seems to be the opaque messages that are affected. I am also
> using
> > sick lasers and psoition2d interfaces at the same time and they all
> seem to
> > work fine. The opaque messages work for a while (not long usually the
> > problem occurs within a minute). I am not sure if my code somewhere
> does
> > something wrong or if there is something wrong in player itself.
> Thats why a
> > was asking if anyone can confirm that it should work. If anyone has
> tried it
> > and been successful than I probably have something wrong in my code.
> >
> > Peter
> >
> >
> > -----Original Message-----
> > From: Toby Collett
> [mailto:tcollett+player@plan9.net.nz<tcollett%2Bplayer@plan9.net.nz>
> > ]
> > Sent: Mon 12/15/2008 8:21 PM
> > To: playerstage-developers@lists.sourceforge.net
> > Subject: Re: [Playerstage-developers] Player crash (sometimes) when
> > receiving opaque messages
> >
> > Are the crashes happening on the server side or the client side? and
> also,
> > are you trying to run a multithreaded client?
> >
> > Toby
> >
> >
> >
> >
> ------------------------------------------------------------------------------
>
> > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
> Nevada.
> > The future of the web can't happen without you.  Join us at MIX09 to
> help
> > pave the way to the Next Web now. Learn more and register at
> >
> >
> http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
>
> > _______________________________________________
> > Playerstage-developers mailing list
> > Playerstage-developers@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/playerstage-developers
> >
> >
>
>
> --
> This email is intended for the addressee only and may contain privileged
> and/or confidential information
>
>
>
>
>
>
>


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Playerstage-developers mailing list
Playerstage-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-developers



--
This email is intended for the addressee only and may contain privileged and/or confidential information