I've developed a webpart that presents a strange behaviour. When I load the page where is installed sometimes it works correctly and sometimes it crashes, but I can't find any pattern (seems random to me).
When I debugged it I saw that have two threads of execution. (The cursor of debug always passes two times over every function in separated threads). How can it be?
I want that only be one thread, and I also suspect that this could be the source of the random crash. Any idea where start to find this error?
EDIT:
Added the two screenshots with the debug