Page 1 of 1

BUG: png support (partially) not threadsafe.

Posted: Sun Feb 25, 2007 4:52 am
by MaierMan
I experienced "cruel" results when I tried to process pngs in a multi-threaded application.
Seems it happens just with some png files while other reliably load.

Wrote a small test application to outline the issue.
http://tn123.ath.cx/gfl/png/
(code makes use of OpenMP and therefore require visual studio (2k5SP1) redist)

Sample pngs available too.
test-bad.png was created using XNView IIRC.
test-ok.png created by Ubuntu screen capture.


Try: e.g.

Code: Select all

gflpng.exe <numfiles <numthreads> <file>
gflpng.exe 100 5 test-bad.png
I tested on three different Systems (all WinXP Pro SP2 32Bit):
AMD Athlon64 X2
Core 2 Duo
Pentium III

Both dual core systems fail >90% of all loads.
That single core system fails <10%.
Using only one thread is always successful.

JPEG, BMP readers seem to work always; other readers not tested.

Conclusion
---
There is still *some* code in the png implementation that is not thread-safe. That code is not always triggered.

Re: BUG: png support (partially) not threadsafe.

Posted: Fri Mar 02, 2007 1:49 pm
by xnview
MaierMan wrote:I experienced "cruel" results when I tried to process pngs in a multi-threaded application.
Seems it happens just with some png files while other reliably load.
So the problem is only reading? With which version?

Re: BUG: png support (partially) not threadsafe.

Posted: Fri Mar 02, 2007 2:13 pm
by MaierMan
xnview wrote:
MaierMan wrote:I experienced "cruel" results when I tried to process pngs in a multi-threaded application.
Seems it happens just with some png files while other reliably load.
So the problem is only reading? With which version?
I didn't test writing.

Should be obvious as I linked against libgfl267.dll. ;)
Side note: 266 is affected as well; other versions untested.

Re: BUG: png support (partially) not threadsafe.

Posted: Tue Mar 13, 2007 2:35 pm
by xnview
MaierMan wrote:Should be obvious as I linked against libgfl267.dll. ;)
Side note: 266 is affected as well; other versions untested.
The multi thread code begin here

Code: Select all

for (int i = 0; i < files; ++i)
I don't know omp

And if you try from file?

Posted: Fri Mar 30, 2007 11:49 pm
by MaierMan
Any news?
Anything I can do to help?
Really gives me headaches.
I feel unconfortable shipping my (minor and unimportant) apps with this bug.
Furthermore I recently work a lot with pngs...

Posted: Tue Apr 10, 2007 6:54 am
by xnview
MaierMan wrote:Any news?
Anything I can do to help?
Really gives me headaches.
I feel unconfortable shipping my (minor and unimportant) apps with this bug.
Furthermore I recently work a lot with pngs...
Not yet, i don't find the problem....

Posted: Fri Jun 01, 2007 3:58 pm
by Ithier
Hi,

Is it the same problem that I had some time ago: http://newsgroup.xnview.com/viewtopic.php?t=3017. I haven't tested again, but I don't think it has been solved.

Posted: Fri Jun 01, 2007 8:43 pm
by MaierMan
Ithier wrote:Hi,

Is it the same problem that I had some time ago: http://newsgroup.xnview.com/viewtopic.php?t=3017. I haven't tested again, but I don't think it has been solved.
Totally forgot about this thread...

Posted: Sat Jun 02, 2007 5:56 am
by xnview
MaierMan wrote:
Ithier wrote:Hi,

Is it the same problem that I had some time ago: http://newsgroup.xnview.com/viewtopic.php?t=3017. I haven't tested again, but I don't think it has been solved.
Totally forgot about this thread...
I have now a dual core, so i'll be able to test...

Posted: Tue Feb 19, 2008 9:00 pm
by MaierMan
As announced in the other thread, here is the version without omp. Using regular win32 threads:
http://tn123.ath.cx/gfl/png/gflpng-noomp.zip

Posted: Thu Feb 21, 2008 5:03 pm
by xnview
I've tried the "gfl crash multi thread" test, and have the problem.

I've build GFL with the new libpng, and now seems that the problem is gone. Could you send me your email to send you a test version?

Posted: Fri Feb 29, 2008 10:05 am
by pber
I've also experienced that problem. Is it fixed with the 2.82 GFL lib?

Posted: Fri Feb 29, 2008 10:58 am
by xnview
pber wrote:I've also experienced that problem. Is it fixed with the 2.82 GFL lib?
yes