Earlier quoted context omitted.
And it indeed does in common usage scenarios. And also in this case once the issue with `synchronized` is resolved. After all, this is a benchmark and it's not surprising that one of the limitations of the design was hit.
"common usage scenarios" != "in all cases". I don't know if those Oracle employees actually did outright say -- or even imply -- "in all cases" as the GP asserted, but if they did, then "only" working in "common usage scenarios" would definitely be overselling the feature.
We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
151–160 of 253 posts
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#152Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#153This problem is not going to go away so easily. Numerous core Java classes (like BufferedInputStream) use synchronized. I count 1600+ usages in java.base. The blocking issue means it's _much_ easier to accidentally run into this, rather than waving it away as an unlikely edge case. I personally ran into this Using the built in com.sun webserver, with a virtual thread executor. My VPS only has two CPUs which means the…
People always forget that things that only happen every few million times, can happen fairly frequently on a busy server. This has bitten me numerous times. The nature of a lot of these types of issues is that they are hard to detect and hard to reproduce. Virtual threads are nice for unblocking legacy code but they aren't without issues. There are better options for new code with less trade offs on the jvm as well.…
https://github.com/jasync-sql/jasync-sql/wiki/API-Overview
From project WIKI (https://github.com/jasync-sql/jasync-sql/wiki)
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#154Erlang is based on virtual threads (confusingly called processes). The Erlang virtual machine schedules them on OS threads. Erlang processes communicate using message passing, preventing deadlocks. You can use millions of Erlang processes without problems, e.g., to handle millions of Elixir LiveView sessions.
You can have deadlock in Erlang, it's just a bit harder. It happens when two processes are both waiting on the other to send them a message which is analogous to two threads each waiting for a mutex the other holds. The same thing can happen in Go with its channels, another message passing based concurrency control mechanism.
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#155Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#156Earlier quoted context omitted.
There's a quality spectrum of AI-generated header images. Some are just random DALL-E output which aren't intrinsically relevant to the article (like the one used in this article), but you can have a little fun with it and do something distinct. This may require more control than just using Bing Image Creator. Also, a thumbnail tip: square thumbnails are bad. If you have to use a square 1024x1024 AI generation, crop…
There's a quality spectrum of AI-generated images, sure, but they're all equally artistically void.
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#157Totally off topic but I am getting tired of the AI generated images used on nearly all blog posts nowadays. They are instantly recognisable, it just seems low effort and lowers the feeling of quality one might otherwise have
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#158Go has a mechanism to spawn a new thread (m in ho runtime parlance) if it thinks one of its threads might be blocked in a cgo (go’s “native function” equivalent). That prevents stuff like this.
So does C# with active blocking detection (which injects threads to counteract this) and hill climbing algorithm to scale threadpool threads automatically.
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#159Totally off topic but I am getting tired of the AI generated images used on nearly all blog posts nowadays. They are instantly recognisable, it just seems low effort and lowers the feeling of quality one might otherwise have
Re: We switched to Java 21 virtual threads and got a deadlock in TPC-C for Postgres
#160Earlier quoted context omitted.
Java does the same for Object.wait(), only the number of such compensating threads is limited by default, but can be extended via config option. They have exhausted the default number of compensating threads, I think. And they are mistaken to call this situation a "pinning" JEP 444: > The vast majority of blocking operations in the JDK will unmount the virtual thread, freeing its carrier and the underlying OS thread…
> The situation with Object.wait() is not what JEP 444 calls "pinning". The "pinning" happens, for example, when one calls `syncronized(....) {blockingQueue.take()}` [...] To call Object.wait() you need to own the objects monitor, which would imply that your code would actually look like `synchronized(....) {Object.wait()}` in which case you would indeed be pinned.
That's different from blocking functions, described in the quote, that does not even try to unmount virtual thread. Like Object.wait().
Pinning is worse than those functions, because the functions compensate for a blocked native thread by adding one more native thread to the pool.