BUG: png support (partially) not threadsafe.

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

Post Reply
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

BUG: png support (partially) not threadsafe.

Post 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.
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

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

Post 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?
Pierre.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

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

Post 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.
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

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

Post 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?
Pierre.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post 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...
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post 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....
Pierre.
User avatar
Ithier
Posts: 47
Joined: Fri Nov 19, 2004 10:50 am
Location: Paris, France
Contact:

Post 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.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post 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...
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post 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...
Pierre.
MaierMan
Posts: 78
Joined: Wed Aug 04, 2004 8:32 pm
Contact:

Post 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
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post 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?
Pierre.
pber
Posts: 9
Joined: Tue Feb 26, 2008 5:27 pm

Post by pber »

I've also experienced that problem. Is it fixed with the 2.82 GFL lib?
User avatar
xnview
Author of XnView
Posts: 43357
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

pber wrote:I've also experienced that problem. Is it fixed with the 2.82 GFL lib?
yes
Pierre.
Post Reply