# Strange local SharedObject problem

**URL:** <https://forum.kirupa.com/t/strange-local-sharedobject-problem/285182>\
**Category:** flash\
**Created:** [March 27, 2009, 11:55pm UTC](https://forum.kirupa.com/t/strange-local-sharedobject-problem/285182 "2009-03-27T23:55:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timo1](https://avatars.discourse-cdn.com/v4/letter/t/34f0e0/32.png) [@Timo1](https://forum.kirupa.com/u/Timo1)\
**Post date:** [March 27, 2009, 11:55pm UTC](https://forum.kirupa.com/t/strange-local-sharedobject-problem/285182/1 "2009-03-27T23:55:30Z")

</div>

I am using a SharedObject to communicate between two different swfs, i.e. the sender writes a prop to it, and the receiver, who is polling, looks for the value. This works 99% of the time, but occasionally all of the properties are being deleted, as if I had called clear() on the SharedObject.

After much investigation, I determined that this happens only when one object is trying to read while the other is writing. I had set up another SharedObject as a mutex, but I only used this to ensure that one and only one program is trying to write at any given time. I figured the worst case of a read in the middle of a write would be some obsolete data, which would be taken care of by the next poll.

I made a test program where, every 10 ms, the program reads a property on the SharedObject, increments it, and writes it back (via flush()). This works just fine, until I run another instance. Then the madness begins.

It doesn’t seem to matter if flush() returns an error or not. I even do another getLocal() after flushing and check the value, and its correct (even when flush returns a 2130 error). However, sometime between then and the next time I try again, the shared object is destroyed (size = 0) and all my data is lost.

Has anyone seen anything like this before?

I’ve attached my sample test.as file, if that’s helpful at all.
