question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Arrays cannot be synchronized on

See original GitHub issue

Under TeaVM 0.6.0-dev-751, the following code will throw a "$o.$monitor is undefined" error within jl_Object_monitorEnterSync:

int[] x = new int[0];
synchronized(x) { }

I believe this was caused by fe68bf700b21ce8cb2667296fbb35d25cf94831e - as arrays are no longer using jl_Object’s constructor, they do not initialize $monitor to null, and so the if ($o.$monitor.$owner === null) check fails, meaning the monitor is never actually initialised.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
konsoletypercommented, May 30, 2019

BTW, I just published 0.6.0-dev-764 version, which includes fix for this issue. This means you can build your project against this version without any patches.

0reactions
SquidDevcommented, May 29, 2019

Amazing, thank you very much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java: how to synchronize array accesses and what are the ...
Yes, you can synchronize using an array as monitor object, because arrays (even arrays of primitives) are objects in Java.
Read more >
Synchronization of ArrayList in Java - GeeksforGeeks
Implementation of ArrayList is not synchronized by default. It means if a thread modifies it structurally and multiple threads access it ...
Read more >
is array synchronized??? (OCPJP forum at Coderanch)
There are no threading issues with that as long as you go through a synchronized block before letting a reference to the array...
Read more >
Synchronize storage array clocks - NetApp
The Synchronize Storage Array Clocks dialog box opens. It shows the current date and time for the controller(s) and the computer used as...
Read more >
MirrorView - Cannot Sync A Group That Is Already Synchronized
I have a MirrorView consistency group that I am attempting to synchronize to force a push of refreshed data to the target array....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found