Im stumped with a debugging problem, maybe you can help?

Here is a good description of the problem without code:

Process one creates a file with records. Each record has a record type and has a size associated with it along with possibly variable length data on some records. The records are written out to a compressed stream using Zlib (gzopen, gzwrite).

Another process transmits the file to another platform. (Totally different hardware and OS).

The third process which has the bug. Opens the file using gzopen and processes the records. However occasionally it gets an unknown record ie one that is not defined and has a large number like 115 or 101, when there are only 9 distinct records from 1-9.

What is strange is that after a restart of the process it is able to correctly read and interpret the file.

So that leads me to believe the file is intact and something else is happening internally.

I've run the code through valgrind, helgrind etc with nothing to report. The process itself is multi-threaded.

So any ideas on how to find whats causing this?

Thanks Ken