maplibre / maplibre-native

MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
https://maplibre.org
BSD 2-Clause "Simplified" License
1.09k stars 321 forks source link

Node 6.0.0/6.0.1.pre.0 freezing in macos/metal after about 32 renders #2928

Open acalcutt opened 1 month ago

acalcutt commented 1 month ago

I have gotten a report in slack and the tileserver-gl repo that the node 6.0.0 for macos is freezing. It will work at first, but after browsing the map the application freezes and stops returning rendered images. I also tested myself and confirmed the issue. https://github.com/maptiler/tileserver-gl/issues/1402 https://osmus.slack.com/archives/C02B2CBSNBU/p1728481702513059

The same code used works fine with the last opengl-2 release, 5.4.1. The 6.0.x versions also seem to work fine on Linux and Windows, and the user who reported mentioned using 6.0.x in docker (linux) did not have the same issue on the same mac hardware.

To Reproduce I have created a simplified node application that just generates the same image 50 times. On Windows this generates all 50 images, but when I test on macos it seems to generate 32 images then freeze, similar to what is happening in tileserver-gl https://github.com/acalcutt/maplibre-node-test/tree/macos_test

The test app can be used like this, I was testing with node v20.17

https://github.com/acalcutt/maplibre-node-test.git
git checkout macos_test
npm i
node .

Expected behavior This test application should generate 50 images in the root folder, but right now on macos it freezes after 32 images are generated and I have to kill the node process to get it to end

Screenshots Not working on macos

Screenshot 2024-10-11 at 9 21 06 AM

Working on windows image

Platform information (please complete the following information):

Additional context I am not completly sure how to troubleshoot this. It generates the first 32 images without issue.

louwers commented 2 weeks ago

If I have to guess it's something CFRunLoop related. I can try replacing it with the libuv implementation to see if that works. It's a bit a shot in the dark but that worked for GLFW.

louwers commented 2 weeks ago

32 images... That sounds like a suspicious number. Maybe something is not cleaned up properly and filled up.

I'll put it on the agenda for Wednesday and see if anyone has any ideas.