Skip to content
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

PoolVectorArray locking issues #331

Closed
OverloadedOrama opened this issue Sep 18, 2020 · 5 comments
Closed

PoolVectorArray locking issues #331

OverloadedOrama opened this issue Sep 18, 2020 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@OverloadedOrama
Copy link
Member

OverloadedOrama commented Sep 18, 2020

Pixelorama version:
v0.8, but it happens with v0.7 too, probably less often. Not sure about previous versions.

OS/device including version:
Windows 10 64-bit. Most likely happens in all platforms.

Issue description:
When working with PoolVectorArrays, or classes that use them, like Image, Line2D, sometimes errors saying "resize: Can't resize PoolVector if locked" appear in the debug console. They look like this.
image

Depending on the situation, it can be relatively harmless, like some tiles missing when drawing the isometric grid, and others it can prevent something from working at all, like when exporting an image to png, an error with code 23 (ERR_LOCKED) appears.

I have observed this issue happening sometimes when: (will update the list if I find more occurrences)

  • Drawing the isometric grid. Some of the tiles might be missing. EDIT: No longer relevant as the isometric grid system has changed.
  • Exporting the project. Image.save_png() returns code 23 and the file fails to get saved. I've noticed that if I draw something and then attempt to export again, it usually works that time. EDIT: Most likely fixed in 63410bd
  • Creating guides. Sometimes the newly created guide doesn't appear, but text showing its position in pixels does appear.
    image
  • Sometimes symmetry guides also don't get created too when making/opening a project.
  • The experimental shader feature. Sometimes when trying to apply a shader to the image, it showed the same error in the console and the cel became blank. This feature is hidden in v0.8, but you can find it in the code. To make it appear, just uncomment the Shader line from setup_image_menu() in TopMenuContainer.gd
  • Using the screen color picker found in the ColorPicker node sometimes does not work and prints "resize: Can't resize PoolVector if locked" in the debug console.

Steps to reproduce:
Honestly, I'm not sure. This error seems very random, although I'm guessing it has to do with the way PoolVector handles memory. Just play around with the occurrences I mentioned above, open multiple projects, and you'll come across this error sooner or later.

This is most likely a Godot bug, but so far I haven't been able to reproduce it in a minimal project in order to submit it to Godot's issues. If anyone knows anything more about the nature of this issue, or potential workarounds/solutions, feel free to reply. It's also worth noting that PoolVector is going away in Godot 4.0, so it's possible that this issue will get fixed when 4.0 is released.

@OverloadedOrama OverloadedOrama added the bug Something isn't working label Sep 18, 2020
@OverloadedOrama OverloadedOrama added the help wanted Extra attention is needed label Sep 26, 2020
@OverloadedOrama OverloadedOrama pinned this issue Sep 26, 2020
@OverloadedOrama OverloadedOrama unpinned this issue Oct 6, 2020
@OverloadedOrama
Copy link
Member Author

Exporting the project. Image.save_png() returns code 23 and the file fails to get saved. I've noticed that if I draw something and then attempt to export again, it usually works that time.

Since 63410bd, I haven't been able to reproduce this issue, so it may be safe to assume that it is now fixed. It seems like the processed_images Array had to be cleared before creating a new Image. I'm still unsure what the exact nature behind this issue is.

@qarmin
Copy link

qarmin commented Feb 27, 2021

Such locking errors I have when working with different Image functions.
Looks that after executing some functions, memory get corrupted and shows this errors.

I believe that fixing godotengine/godot#46480, godotengine/godot#46481, godotengine/godot#46483 etc. will fix this issues in Pixelorama.

I probably can't fix this issues due to not having enough skills, but I can provide easy to reproduce steps with minimal projects(just like in issues above)

OverloadedOrama added a commit that referenced this issue May 12, 2021
Related to the PoolVectorArray locking issue (#331). This still doesn't fix the issue itself, but at least Pixelorama does not crash anymore. It is still possible, though, to fail to load a guide when opening a project. Opening it again may solve the issue.
@Variable-ind
Copy link
Contributor

Variable-ind commented Jul 13, 2021

Steps to reproduce:
For Guides this error seems to happen when pixelorama is put under much load/stress (trying motion painting with a speed of 100 Fps always causes this bug). i tried it 3 times and it happened every time:
Attempt 1:

pool.vector-.2.mp4

Attempt 2 and 3 (both one after another)

pool.vector.b.mp4

@Variable-ind
Copy link
Contributor

A new error reproduction steps for PoolVector isues in Godot screen ColorPicker:

test-2021-07-23_06.29.55.mp4

@OverloadedOrama
Copy link
Member Author

It's very likely that the latest commit (1d20295) might have finally fixed the issue. Or at least it made it more rare. I haven't been able to reproduce the issue so far after these changes.

The changes in that commit are that images no longer remain locked forever, and they get unlocked after the user is done with drawing. It seems that this was the cause of the issue. Maybe the fact that images were locked didn't let any other PoolVector also get locked? Some kind of memory conflict perhaps? In any case, it's very possible that this problem may have not been solved, or may re-appear again in the future. If that's the case, we'll re-open this issue. Nevertheless, Godot 4.x gets rid of PoolVectors and images will no longer require locking/unlocking to get edited, so if we move to Godot 4.x, this problem should never appear again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants