mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
1.95k stars 228 forks source link

[Bug] Segfault in static_accel_shutdown_gpu #1064

Open dvicini opened 5 months ago

dvicini commented 5 months ago

Hi,

I am getting a segfault in static_accel_shutdown_gpu. More precisely, it appears that the optixProgramGroupDestroy call in line 183 of optix_core.cpp in Dr.Jit segfaults when the JIT & optix are shutdown.

I don't quite understand why this happens and don't see an obvious issue with the code. Maybe something subtle on the OptiX side? Or something related to the ordering of free/shutdown operations?

I am on driver 525.147.05 and am using an RTX A5000.

Minimal reproducer:

import mitsuba as mi
import numpy as np

def main():
  mi.set_variant('cuda_ad_rgb')
  scene = mi.load_dict(mi.cornell_box())
  img = mi.render(scene)
  print(np.array(img))

main()
merlinND commented 5 months ago

Hi @dvicini,

I've recently pushed this which I thought was fixing a use-after-free (reported by AddressSanitizer), but maybe it was a mistake? https://github.com/mitsuba-renderer/mitsuba3/commit/0bcfc72b846cd5483109b1323301755e23926e76

dvicini commented 5 months ago

Hi Merlin!

I've been seeing this segfault for some time already. I checked to be sure, your commit doesn't seem to affect it. Before and after that fix I am getting the same segfault.

merlinND commented 5 months ago

Okay, thanks for checking!