Hi Milan, I may have identified a potential cause for this concurrent access problem.
If I'm correct, it should also affect the thread_notif_fetch.c sample code I had pushed on svn few days ago. In your code, you are creating two threads within the same session, which means they share the same session context. If MAPI operation overlaps such as the emsmdb_transaction_null combined to MAPI calls involved in the fetching process, this may lead to unpredictable behavior, probably causing the underlying segfault. In thread_notif_fetch.c, it doesn't show up, probably because of the sleep(1) timer which "masks the problem". Another clue which points me into this direction is the MAPI_E_INVALID_PARAMETER MonitorNotification returns while it shouldn't. My preliminary conclusion is that we can avoid this problem is we add a mutex to the session context and add some locks where necessary to prevent this overlap (memory overwritten etc.). I'll first try to modify your code and add mutexes at the application layer. If it fixes the issue, I'll next patch libmapi to add mutex support. Cheers, Julien. On Thu, 2010-04-29 at 19:40 +0200, Milan Crha wrote: > Hi all, > I added one more "example" to the OpenChange, though it should be rather > in some 'tests' directory or something like that, but anyway: > I took Julien's multiple_notif.c file and added there two more threads, > where each of them is reading a content of Inbox of the profile. > Everything works fine as long as nothing changes on the server. As soon > as I change something in the Inbox, like marking message as read, or > receive a new message, then the test application crashes, with a > backtrace as shown in the bt.txt file attached. > > It aborts in Thread 2. Are you able to do with this anything? > > You know, this crash seems to happen quite low in the code, on a place > which seems to me as untouchable from the test application, but I can be > wrong. The thing is that we have similar crashes in evolution-mapi since > were added support for multiple sessions, though I believe I would be > able to reproduce the same with only one session in use. > > Just to mention, mine OpenChange revision is 1765. > Thanks and bye, > Milan > _______________________________________________ > devel mailing list > devel@lists.openchange.org > http://mailman.openchange.org/listinfo/devel Julien Kerihuel j.kerih...@openchange.org OpenChange Project Manager GPG Fingerprint: 0B55 783D A781 6329 108A B609 7EF6 FE11 A35F 1F79
signature.asc
Description: This is a digitally signed message part
_______________________________________________ devel mailing list devel@lists.openchange.org http://mailman.openchange.org/listinfo/devel