Issue #28 resolved

running pystbimage test fails 20-30% of the time on Windows

Leonard Ritter
created an issue

The {{{testing/test_load.py}}} test from pystbimage ( https://bitbucket.org/duangle/pystbimage ) fails about 20-30% of the time when directly executed (python test_load.py) on Windows 7. The test loads a png file, generates a ASCII-art string and compares it to the original. In the failing cases, the first character (which is within the first four bytes) occasionally contains garbage:

{{{ C:\devel\pystbimage\testing>python test_load.py @

                           @@@
                  @@      @@@@@      @
                 @@@@@@@@@@@@@@@@@@@@@@
                  @@@@@           @@@@@
               @@@@@            @    @@@@
          @@@@@@@           @@@@@@@@@  @@@@@@@
           @@@@@          @@@@@@@@@@@@@  @@@@@
            @@@          @@@@@@@@@@@@@@@  @@@
           @@@          @@@       @@@@@@@  @@
          @@@@          @          @@@@@@  @@@@
        @@@@@@                @ @@ @@@@@   @@@@@@
          @@@@                @@@@@@@@@    @@@
           @@@                 @@@@@@      @@
            @@@                           @@@
           @@@@@                         @@@@@
           @@@@@@@                     @@@@@@@
                @@@@                 @@@@
                  @@@@@@         @@@@@@
                 @@@@@@@@@@@@@@@@@@@@@@
                          @@@@       @
                           @@@

Traceback (most recent call last): File "test_load.py", line 68, in <module> test_load() File "test_load.py", line 65, in test_load assert s == RESULT_IMAGE AssertionError }}}

This error never happened on Linux.

Comments (2)

  1. Armin Rigo

    I get occasionally segfaults on Linux. I can spot a bug: you use "result = _ffi.gc(...)", but then the variable "result" doesn't survive the current function, because you cast it again later. This means the finalizer is going to be called very early, which is probably not what you want.

    Just disabling _ffi.gc() gets rid of the segfaults on Linux. I didn't try Windows so far but I guess it fixes the problem too?

  2. Log in to comment