-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when editing/opening a huge tileset atlas #86226
Comments
ps. i just tested it with existing and new projects, it also sometime crashes when using relatively smaller spritesheets as well. |
If your textures are larger than this, consider reducing their size or splitting them into smaller textures.
3 TileMap Performance: If the issue is related to the TileMap's performance, consider optimizing the TileMap. For instance, you can adjust the quadrant_size property of the TileMap to improve performance
Try to simplify the collision shapes or use fewer of them. |
thanks! i will try this approach. but does this explain how the tileset editor is laggy when editing it despite having smaller texture atlas? |
Same issue occurs while using a texture of only 384*320 pixels. Editor consistently crashes when creating new tiles, editing custom-data and/or setting up terrains, alternatiove tiles etc. |
similar issue #63534 |
Same here, it's a really small texture, but the editor keeps crashing, I can't work! |
Also the same, getting a freeze and crash especially when setting up tiles that take up multiple squares, even after reducing tileset size. Usually after only 2~3 of them. |
After investigating, the cause of the crash seems to be the editor raising this error in an infinite loop until crash: ERROR: Condition "p_elem->_root != this" is true. at: remove (./core/templates/self_list.h:80) Seems to be some kind of thread conflict kind of error |
Same problem here! I was working sice 2 weeks in 4.2 estable. Since yesterday when i was to change my tileset. Didnt happen before in 4.1 (the original project version). Tried in 4.2.1 and same problem. Does not crash when painting in map, crashes when making terrain, adding new terrain layer and picking the color, when activating the tiles, sometimes directly when clicking over the node with Tilemap to edit... In any case same error in infinite loop: ERROR: Condition "p_elem->_root != this" is true. at: remove (./core/templates/self_list.h:80) Maybe something that was changed from 4.1? Or when upgrading the project from 4.1 to 4.2? Can i follow the code will compiling to check where is the infinite loop? (I think it may be a while loop waiting until remove that never happens but cannot guess where it comes) My greatest tileset is 1536 x 1152, so isnt big enough On thing i did before starting crashing was change project to Render -> Compatibility and then return back to Render -> Mobile. Can be? |
I'm working in Compatibility, and I created my project in 4.2 so I don't think upgrading is the issue. |
I am loading the code of editor trying to debug (it is my first time, i do not know how). I can bet the problem is in Clear() method that gets in while loop forever. if anyone knows where is called that method |
This was noticed previously but was said to be solved, can someone please provide a minimum reproduction project to make this easier to investigate, the original issue was not reproducible almost at all so fixing or investigating it was impossible
See: |
There you go, I've copied over my buggy tilemap to a blank project and stripped it down as much as the constant crashes allowed me (it used to have a script, multiple layers, more atlases etc. removing all that didn't stop the crashes from happening or change their frequency) Interestingly, remaking a tilemap from scratch didn't show any issues, unlike copying the broken one... |
I have the same issue, i was playing since 1 hour with a new project tilemap trying to reproduce error without luck. I am going to try what @Nualie you just did to reproduce I tryied in version 4.2 RC2 as the link and also crashes |
I upload the project with the bad tilemap. I removed anything else from the project. You can reproduce trying to draw the terrain like in the image below: |
I can confirm that if the project is changed to 4.1.2 does not crash. Same for the GodotMyCrash i uploaded with minimum to reproduce. And when returning to back to 4.2.1 crashes. Something was broken between 4.1 and 4.2 An easy way to reproduce is create a new Terrain in TerrainSets of Tilemap and moving around color selector. In most cases crashes Update: I checked with diferent versions of 4.2 and works fine until Godot 4.2 dev4. Before that Godot 4.2 dev5 and so on crashes. So the problem is in something on dev5 commits |
Can you please try with 4.1.3 as well? |
In 4.1.3 works fine I am starting to thing it could have something to do with this And maybe old Tilemaps can crash for not containing something new for that improvements My next move is to try to create a simple project with tilemap before 4.2 dev5 and see if crashes in dev5 and after @Nualie You said the project was from start 4.2, but maybe 4.2 dev? |
I will try to take a proper look at this in the next few days, I was investigating the original issue for some time but since it didn't have an MRP reproducing it reliably was impossible and therefore no fix was possible, this should help, I am 90% sure this is due to either some invalid copying of the I'd appreciate if someone who can reproduce this can test this PR, as it fixes one of the possible causes of this, if nothing else it narrows it down, and I will investigate it when I find the time: |
nope, 4.2 mono stable @Ekaitzsegurola |
I compiled your Pull Request. Is over 4.2 RC2 right? It does not work. I am not sure but seems to crash even faster Same error in infinite loop ERROR: Condition "p_elem->_root != this" is true. at: remove (./core/templates/self_list.h:80) How can i compile for Mono C#? |
It's on top of Thank you for testing, then I'll get to looking at this when I can 🙂 |
I have compiled two versions: One before this commit and another after. Before works fine, after versión crashes. So, should be here Before commit (Fine): 31a7fd1 8c1e282#diff-9bb6e79d028fa7d506aa846b3c2bbe33893107cb3d0c9e58f0a2cae1a3ca4234 If i can help in anything do not hesitate to ask |
Here's a possibly slightly too small MRP. It seems harder to trigger quickly with small/simple tilemaps, but with some patience I can reliably hit it with this: Steps:
Usually within ~30s, the editor should stop responding. If you have a terminal visible you should see the
spam until it fills up the message buffer and crashes |
Thank you for those pointers, will investigate soon when I find the time |
Probably because
triggers the async _internal_update godot/scene/2d/tile_map_layer.cpp Line 2043 in c8c483c
via ~ Line 308 in c8c483c
while
|
this seems to be a different issue considering that the error message is completely different. You have invalid tiles displayed in your screenshot, and the error message says one of the tiles of the pattern just isn't defined. |
TilesEditorUtils calls tile_map->set_pattern from a thread (to refresh tile pattern preview images). set_pattern sets each of the cells into the temporary map, marking them dirty via set_cell. This can race against the tree invoking the TileMapLayer's internal_update, which proceses dirty.cell_list and eventually clears it. If a cell's shared dirty entry ends up losing the race, clear can get stuck in an infinite loop where remove refuses to change it because the entry doesn't think it's a member of the list, but the list head still points to it. This spams ERROR: Condition "p_elem->_root != this" is true. at: remove (./core/templates/self_list.h:80) And eventually leads to a crash when the error message buffer fills. Guarding the list mutations avoids the race that sets up for this failure, fixing godotengine#86226.
There may be more general purpose fixes, but #87458 made sense to me and seems to prevent this |
(please avoid referencing issues in commits, as you can see it badly pollutes the thread and makes it hard to follow) |
Investigated and this particular issue is caused by the preview generation being run on a thread and causing race conditions, there is possibly a broader thread safety concern with |
To ensure more general thread safety I would suggest possibly not doing internal updates when not on the tree, this would make it possible to ensure thread safety, but will have to investigate further if this affects usability in general, but would probably be a separate PR unless there's no impact on the results as it'd break compat at least to some degree and this fix would be good to get for the editor crash in a future 4.2 version |
Tested versions
4.2.1
System information
Windows 11 Godot 4.2.1
Issue description
there seems to be a bug where it crashes when editing and opening a tile set with a huge set of textures
Steps to reproduce
Create a new tileset -> Drag and drop the given atlas for editting = either going to be laggy, or crash
Minimal reproduction project (MRP)
none
The text was updated successfully, but these errors were encountered: