Have you tried closing the session once you don't need to change it any
more? I don't remember exactly but I think the function is named
something like session_write_close().
This simple step solves most of the "random" issues with php's sessions
as it allows other scripts to read the same session file.