Bug 2173510

Summary: perl-SDL-2.548-16.fc38 FTBFS: tests hang
Product: [Fedora] Fedora Reporter: Petr Pisar <ppisar>
Component: sdl12-compatAssignee: Neal Gompa <ngompa13>
Status: CLOSED ERRATA QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: hdegoede, igor.raits, ngompa13, perl-devel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: https://koji.fedoraproject.org/koji/buildinfo?buildID=2125152
Whiteboard:
Fixed In Version: sdl12-compat-1.2.60-3.fc39 sdl12-compat-1.2.60-3.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-03-22 14:06:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2177189    

Description Petr Pisar 2023-02-27 07:15:42 UTC
I experience for many weeks (months?) that building perl-SDL-2.548-16.fc38 in mock environment never finishes because it hangs in t/core_video.t:

├─screen(1392)─┬─bash(1393)───bootstrapbatch(1461)───perl(4730)─┬─mock(1727008)───systemd-nspawn(1728732)───(sd-stubinit)(1728734)───rpmbuild(1728737)───sh(1734798)───Build(1734799)───perl(1735434)

$ ps w 1728737 1734798 1734799 1735434
    PID TTY      STAT   TIME COMMAND
1728737 ?        Ss     0:00 /usr/bin/rpmbuild -bb --target x86_64 --nodeps /builddir/build/SPECS/perl-SDL.spec
1734798 ?        S      0:00 /bin/sh -e /var/tmp/rpm-tmp.mhVYe1
1734799 ?        S      0:00 /usr/bin/perl ./Build test
1735434 ?        t    2533:15 /usr/bin/perl t/core_video.t

strace on 1735434 does not show anything. gdb shows:

(gdb) bt
#0  0x00007f01ba3d1f60 in SDL_FreeYUVOverlay () from target:/lib64/libSDL-1.2.so.0
#1  0x00007f01ba1d710d in XS_SDL__Overlay_DESTROY (my_perl=<optimized out>, cv=<optimized out>)
    at lib/SDL/Overlay.xs:87
#2  0x00007f01ba725fca in Perl_pp_entersub () from target:/lib64/libperl.so.5.36
#3  0x00007f01ba67c1d6 in Perl_call_sv () from target:/lib64/libperl.so.5.36
#4  0x00007f01ba72c063 in S_curse.lto_priv.0 () from target:/lib64/libperl.so.5.36
#5  0x00007f01ba72c7a8 in Perl_sv_clear () from target:/lib64/libperl.so.5.36
#6  0x00007f01ba72cdc2 in Perl_sv_free2 () from target:/lib64/libperl.so.5.36
#7  0x00007f01ba75e380 in Perl_leave_scope () from target:/lib64/libperl.so.5.36
#8  0x00007f01ba765215 in Perl_pp_leave () from target:/lib64/libperl.so.5.36
#9  0x00007f01ba717388 in Perl_runops_standard () from target:/lib64/libperl.so.5.36
#10 0x00007f01ba681fcd in perl_run () from target:/lib64/libperl.so.5.36
#11 0x000055ac92f3434a in main ()

I think a similar problem was observed in Koji on Fedora 38 mass rebuild.

Comment 1 Petr Pisar 2023-02-27 07:27:01 UTC
It busy-waits on this line:

SDL_FreeYUVOverlay (overlay12=0x55ac9480db70) at /usr/src/debug/sdl12-compat-1.2.60-2.fc38.x86_64/src/SDL12_compat.c:7535
7535                if (overlay->overlay12 == overlay12) {

in this cycle:

7530        if (overlay12) {
7531            SDL_Renderer *renderer = LockVideoRenderer();
7532            SDL12_YUVData *hwdata = (SDL12_YUVData *) overlay12->hwdata;
7533            QueuedOverlayItem *overlay = QueuedDisplayOverlays.next;
7534            while (overlay != NULL) {
7535                if (overlay->overlay12 == overlay12) {
7536                    overlay->overlay12 = NULL;  /* don't try to draw this later. */
7537                }
7538            }

The variables look like this:

(gdb) p *overlay
$4 = {overlay12 = 0x0, dstrect12 = {x = 0, y = 0, w = 100, h = 100}, next = 0x0}
(gdb) p *overlay12 
$5 = {format = 1448433993, w = 200, h = 220, planes = 3, pitches = 0x55ac9480dbd8, pixels = 0x0, hwfuncs = 0x1, hwdata = 0x55ac9480dba8, hw_overlay = 1, UnusedBits = 0}

It looks like a logic bug in the code: "overlay" variable is never nulled in that cycle, thus the cycle never terminates. Maybe it should have been of a register storage and updated by a different thread/process.

Comment 2 Petr Pisar 2023-02-27 16:05:54 UTC
a/register storage/volatile storage/

Comment 3 Petr Pisar 2023-03-10 10:44:32 UTC
Plain "perl -Iblib/{lib,arch} t/core_video.t" without an X server also hangs.

Comment 4 Petr Pisar 2023-03-10 10:55:54 UTC
This is triggered by upgrading sdl12-compat from 1.2.52 to 1.2.56.

Comment 5 Petr Pisar 2023-03-10 12:03:06 UTC
I confirm the upstream test fixes this problem. If you don't have time, I can apply the patch to the Fedora sdl12-compat package.

Comment 6 Petr Pisar 2023-03-10 12:03:40 UTC
s/test/patch/

Comment 7 Fedora Update System 2023-03-22 14:01:49 UTC
FEDORA-2023-c29ef60a0d has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-c29ef60a0d

Comment 8 Fedora Update System 2023-03-22 14:06:00 UTC
FEDORA-2023-c29ef60a0d has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2023-03-22 14:20:59 UTC
FEDORA-2023-1a3cea1a37 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-1a3cea1a37

Comment 10 Fedora Update System 2023-03-23 00:16:33 UTC
FEDORA-2023-1a3cea1a37 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.