Bug 91982

Summary: [radeonsi] fs leak in get_radeon_bo()
Product: Mesa Reporter: Shawn Starr <shawn.starr>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED INVALID QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: ikalvachev
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Crash of apitrace due to fd leakage
Valgrind output
More detailed valgrind trace
Valgrind trace of memory leaks in Mesa3D when compiling same shader over and over. R600 Redwood variant.
Valgrind output with ulimit capped at 1GB (Virtual)

Description Shawn Starr 2015-09-11 19:03:48 UTC
While debugging something for Borderlands 2, I broke the DRI driver, tripped a file descriptor leak

Mesa git master (Sept 10th build), kernel 4.3.0-0.rc0.git9.2.fc24.x86_64m libdrm-2.4.64 aug 18th

Steps to reproduce fd leak
==========================

Take my trace for Borderlands 2 from here: https://drive.google.com/open?id=0Bze7CJKD12nORWQ4RTdIbk4zT1k

1) apitrace trim --frames=0-2469 --exact -o bl2469.trace Borderlands2-menu.trace
2) apitrace replay --loop -b bl2469.trace

Wait... it will crash... see attachment

Kernel:

[129925.490377] VFS: file-max limit 100000 reached
[129925.651137] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (135168, 2, 4096, -23)
[129925.651717] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (135168, 2, 4096, -23)
[129925.652239] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (135168, 2, 4096, -23)
[129925.652754] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (135168, 2, 4096, -23)
[129925.653278] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (1216512, 2, 4096, -23)
[129925.653813] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (1216512, 2, 4096, -23)
[129925.764233] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (8847360, 6, 16384, -23)
[129925.764829] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (8847360, 6, 16384, -23)
[131671.087659] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (4096, 6, 4096, -23)
[131671.207257] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (4096, 6, 4096, -23)
[131671.241259] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (4096, 6, 4096, -23)
[131671.311307] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (4096, 2, 4096, -23)
[131671.312227] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (4096, 2, 4096, -23)
[131671.331355] [drm:radeon_gem_object_create [radeon]] *ERROR* Failed to allocate GEM object (3244032, 2, 4096, -23)

See attachment for stack dump from DRI
Comment 1 Shawn Starr 2015-09-11 19:04:17 UTC
Created attachment 118218 [details]
Crash of apitrace due to fd leakage
Comment 2 Michel Dänzer 2015-09-13 15:42:28 UTC
This could also be a bug in apitrace, couldn't it?

Can you try running it in valgrind --leak-check=full to see if that shows anything interesting?
Comment 3 Shawn Starr 2015-09-14 01:40:00 UTC
Created attachment 118251 [details]
Valgrind output
Comment 4 Shawn Starr 2015-09-14 03:12:16 UTC
Created attachment 118252 [details]
More detailed valgrind trace
Comment 5 iive 2015-09-14 07:39:38 UTC
Created attachment 118258 [details]
Valgrind trace of memory leaks in Mesa3D when compiling same shader over and over. R600 Redwood variant.

You need to run valgrind with `--trace-children` to check something else than apitrace itself. :)

I'm attaching log created with the following command:

`valgrind  --log-file=mesa.memleak.r600.valgrind.txt --trace-children=yes  --leak-check=full --undef-value-errors=no --partial-loads-ok=yes --freelist-vol=200000000 apitrace replay --loop -b bl2469.trace`

I didn't let it die from memory exhaustion, I pressed ESC and exited normally, so the leaks in this log are definitely lost.
Comment 6 Shawn Starr 2015-09-14 18:35:14 UTC
Created attachment 118270 [details]
Valgrind output with ulimit capped at 1GB (Virtual)

This is stdout output only
Comment 7 Dave Airlie 2015-09-14 21:44:36 UTC
does it happen with the original untrimmed trace?

this seems like an apitrace bug not a mesa bug.
Comment 8 Shawn Starr 2016-08-31 03:51:00 UTC
I defer to Dave on this one, there's been so much changes recently this bug is probably obsolete anyway.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.