News for hackers. Stuff that matters.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by tyingq on Friday February 05, 2021 @08:23AM (#26036010)
To be fair, the chain is Java 8, Java 11, Java 17 (TBA) if you only consider LTS versions.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @08:55AM (#26036306)
Java doesn't have LTS versions. All versions are equal, and vendors sell long-term support services to arbitrary versions of their choosing. The most recent version you can buy an LTS service for from Oracle is 11, and most, though not all vendors pick the same versions as Oracle for their support service.

BTW, LTS is mostly designed for legacy applications, i.e. those that don't see much development. The recommended version for use in production by applications that are heavily maintained is always the current version (15, and soon 16). It is true, however, that many people still misunderstand Java's LTS, and perhaps confuse it with the notion of LTS in other ecosystems, and so many choose an old version and buy LTS even if it's not the best option for them.

(I work at Oracle on OpenJDK)

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by tyingq on Friday February 05, 2021 @09:07AM (#26036438)
Sure, so if I go to adoptopenjdk, the home page offers up 2 LTS versions (8,11) , and "LATEST". Same for Amazon's Corretto. And they all make note of LTS or not.

I believe you, but that message isn't front and center on the various OpenJDK distributions.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @09:15AM (#26036500)
Sadly, while Java is otherwise careful to enforce various standards, anyone is free to call whatever they like LTS. OpenJDK (the source of most JDK distributions) has no concept of LTS (e.g., you'll find no mention of LTS here: https://openjdk.java.net/projects/jdk/11/). Different vendors can call LTS whatever they like, and what that actually entails depends on the vendor.

If we define LTS to at least include long-term maintenance in the form of bug and security fixes of the entire JDK, then no one offers a free LTS. Free offerings that call themselves LTS are just builds of the OpenJDK Updates project, that backports fixes from mainline, and so only includes fixes for the intersection of the old version and the current one (i.e. no "free LTS" offers patches for, say, CMS or Nashorn, and multiple other components that exist in 11 or 8 but not in 16). "Free LTS" offerings are only recommended for legacy hobby projects. Important production software should use either the current version (free) or buy an LTS service for an old version from some trusted vendor. The only version that is fully and freely maintained is the current one, and it also offers the cheapest upgrade process and the best performance. Don't think that if the vendor calls something LTS and ships updates that include some fixes you're actually getting some fully-maintained JDK.

BTW, AdoptOpenJDK is not affiliated or involved with OpenJDK, and is made by an IBM team that is exceptionally uninvolved and unfamiliar with OpenJDK compared to all other OpenJDK distributions (Oracle, Red Hat, SAP, Azul, Bellsoft, and Amazon).

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by scns on Friday February 05, 2021 @10:33AM (#26037407)
Hm, my impression is that usually OpenJDK 8 is the fastest:

https://www.phoronix.com/scan.php?page=article&item=openjdk-...

https://www.phoronix.com/scan.php?page=article&item=graalvm2...

(edit: added missing version (slighly embarassed) and second link)

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @01:10PM (#26039353)
It's definitely the slowest, and by pretty significant margins. Those tests did, however, uncover bad default settings in JDK 14 on some machine sizes, which happened to be those Phoronix ran their benchmarks on: https://kstefanj.github.io/2020/04/16/g1-ootb-performance.ht... Those bad defaults are fixed in 15.

Moving away from 8 results in a significant saving in hardware/hosting costs for the vast majority of large applications.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by cesarb on Friday February 05, 2021 @09:47AM (#26036818)
Linux distributions too, they all seem to offer three Java packages: one for Java 8, one for Java 11, and one for Java "latest". The default is either the Java 8 one or the Java 11 one.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by dcminter on Friday February 05, 2021 @09:21AM (#26036560)
I've seen a reluctance to move from Java 8 because of the issues upgrading past Jigsaw (e.g. the build I'm working on today bleeds warnings about groovy doing illegal reflective access - and that's just a cosmetic issue) and so many shops decided to wait until the "LTS" Java 11 came along to make the jump.

Now that they're there and with the memory of the upgrade pain there's reluctance to upgrade again before Java 17. I think once they do that and see a much more normal upgrade path for that leap they'll be a lot more willing to track all the releases and not just the LTS ones (real or not it's perceived as being a thing).

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @09:31AM (#26036661)
I agree. Funnily enough, though, the upgrade pain to 9+ had nothing to do with Jigsaw, because its encapsulation hasn't even been turned on (unless you count warnings). It was just the biggest and most visible change, so people blamed their unrelated upgrade issues on it. The actual cause for many issues was that some popular libraries hacked into off-specification, undocumented JDK internals and relied on them (Groovy did that a lot), and they simply changed, as they're allowed to. The most disruptive specification change was actually dropping the "1." prefix from the version string, that many codebases used to parse.

Starting with JDK 16, Jigsaw is finally being fully turned on, and is starting to block access to internal JDK classes unless the application explicitly allows it. Ultimately, this will force libraries not to rely on internal implementation details and so get themselves tied to a specific version.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by dcminter on Friday February 05, 2021 @11:24AM (#26037975)
While I remember, here's a good example of an (IMO) bad decision being made due to the LTS meme: https://lists.ubuntu.com/archives/ubuntu-release/2018-Februa...

Point taken about the actual underlying causes of the upgrade pain though.

Speaking personally I very much appreciate all the work that goes into delivering OpenJDK and I think some of the anti-Java groupthink that exists on HN is regrettable.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by abraae on Friday February 05, 2021 @01:10PM (#26039346)
I suspect there is a silent majority who enjoy Java's industrial reliability, its longevity, and the sheer volume of libraries and online resources, and can't be bothered raising their heads above the parapet every time someone starts ranting on about how crap OOP is.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by cesarb on Friday February 05, 2021 @10:01AM (#26036985)
> and so many shops decided to wait until the "LTS" Java 11 came along to make the jump

Even if they didn't decide to wait, they had to wait until all libraries they depend on made the jump. Many of them took a long time (as late as last year, I was still seeing "fix something which breaks in Java 9" in library changelogs), and sometimes the compatibility with Java 9 was only available on a newer major release of the library, which sometimes required upgrades to major releases of other libraries, and so on, and to make it even more painful some of these major releases dropped support for older Java releases like Java 7, which some of your clients might be using.

Migrating to Java 11 was actually more painful than migrating to Java 9, since Java 11 removed some of the things deprecated by Java 9 (this was a very short deprecation cycle, only one year between deprecation and removal), like all of J2EE; and IIRC, not all of the removed things were available as separate libraries (for instance, I recall CORBA being listed as not available separately, so once it was removed from the JVM, there was no alternative if you depended on it).

And there's the fact that, if you expect to run on the default-installed JVM in the latest release of a popular enterprise Linux distribution, you have to keep compatibility with Java 8. So all this pain is for next to zero gain (the only real gain is some GC improvements, if your client is willing to risk using Java 11 and encountering obscure bugs in your software).

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @10:13AM (#26037155)
Well, the main gain we're seeing that attracts most companies is money, sometimes lots of it. Savings on hardware due to performance and footprint improvements are often so large that they very quickly offset any migration costs. Here's a pretty common experience from LinkedIn: https://youtu.be/1AYTFRUTyao?t=14411. Systems that don't migrate are usually those that carry little hosting costs and/or make little money.

Second, as someone who works on OpenJDK I can tell you that the belief that JDK 8 is more stable than 15 (or even 11) is misguided either based on how they're actually maintained (an order of magnitude more people maintain 15 than 8, and while they backport some fixes, they don't backport them all, and we've had a few incidents of bugs introduced through misapplied patches) and the actual bug data. It is true that some new features might be less stable, but it's safer, at this point, to use 15 (or 11) than 8.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by cesarb on Friday February 05, 2021 @11:15AM (#26037883)
> I can tell you that the belief that JDK 8 is more stable than 15 (or even 11) is misguided either based on how they're actually maintained

The instability comes not from bugs in the JVM, but from how even tiny changes in the JVM can interact with the software running above it. For instance: Java 15 changed the return value of the getMessage() method of the NullPointerException generated when accessing a null pointer. That shouldn't have made any difference; yet, there is code which accidentally depends on its former return value, and that code is probably in a little used corner of the system where it will break when you least expect.

Java 8 is a known variable; you can expect it to have many less breaking changes than chasing the latest Java release (and if you are in the "latest Java release" train, you have to chase the latest Java release, since there's little if any overlap in their support period). It's a solid base for you to build your software on top.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by dcminter on Friday February 05, 2021 @11:45AM (#26038228)
Yeah, I was going to chip in; there are two kinds of stable.

You can say "Java N" is more stable than "Java 8" because they crash less often under fewer circumstances.

But you can also say "Java 8" is more stable than "Java N" because we know most of the bugs in "Java 8" already so we can avoid them (and we don't exercise the unknown bugs very often because we'd have worked around them by now if we did).

Often that second kind of stability is more important than the other one.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by grandiego on Friday February 05, 2021 @07:36PM (#26042980)
> It's a solid base for you to build your software on top.

Agreed. It is what I usually find at client installations in backend systems (at least for the last five years). IMHO it would be pointless to ask them to re-test/re-certify all their already running applications (in turn, specified for Java 8 by their respective providers), with promises about (unrequested) performance gains.

BTW, I remember in the past the only way for me to "push" some clients to upgrade from Java 5/6 (to Java 8) was the security/regulatory threat related to running an "unsupported" version of Java: think of the regulatory move from TLS 1.1 to 1.2 and now into 1.3.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @01:05PM (#26039279)
> Java 8 is a known variable

You might think that, but that's not the case. At least as far as OpenJDK goes, some new features, including huge ones (like JFR) have been backported to it. I believe that the NPE message is being considered for backport, too.

> It's a solid base for you to build your software on top.

It's old tech, that -- unless you actually buy paid support -- is only partially maintained through backports from mainline only. If you're not buying support, it's a less solid, more risky base than the current version.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by scns on Friday February 05, 2021 @02:05PM (#26039971)
Thanks for the link, very useful information.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by AtlasBarfed on Friday February 05, 2021 @11:21AM (#26037944)
Did they ever resolve sun.misc.unsafe replacement since it was being deprecated/removed at some point?

Basically every high performance app uses that to bypass the vagaries of GC. It may not impact a day-to-day enterprise dev, who is going to be behind by 8 versions for years due to the issues with enterprise IT deployment/policy/management/prioritization.

I have to hand it to Oracle, this every six months release thing was a brilliant way to squeeze money from customers and absolutely screw over the OSS users and ecosystem in the long run.

Google/Android or Amazon could have acquired Java for decimal points of yearly revenue. Likely less than google's legal fees.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @01:07PM (#26039317)
sun.misc.Unsafe has not been removed or blocked, and yes, there's also safe replacements -- VarHandles and the foreign memory API -- for much of its functionality, which will be removed piecemeal.

> I have to hand it to Oracle, this every six months release thing was a brilliant way to squeeze money from customers and absolutely screw over the OSS users and ecosystem in the long run.

Huh? How? We've open sourced the entire JDK, making it -- for the first time in Java's 25-year history -- 100% open-source, and we did away with major releases altogether, keeping only the minor ones, and making upgrades cheaper and easier. It's true that some people have not yet internalised what the change means, though. All change is scary, but this one is definitely better for users and for FOSS Java.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by AtlasBarfed on Friday February 05, 2021 @05:55PM (#26042270)
In my opinion (obviously a downvoted one but whatever), it fundamentally destabilized the whole ecosystem with a massive deluge of near-breaking changes.

I get for startups or people running immediate-to-production deployments that it is doable.

But Java's ecosystem is boring, staid enterprise, and those people are still running critical systems on Windows XP or worse. IF they are dragging their feet on THAT...

The churn basically stuns these people into 1) staying on Java8 for a LONG time, or 2) look at rewriting the system in something else, or 3) scaring them into paying money.

I have been doing mostly groovy for the last 10 years so not a single feature in the Java besides invokedynamic (which was really a JVM feature not a Java feature) has impacted me in a good way. Meanwhile... that churn.

As a Cassandra user I have seen the "what the hell do we target" conversation play out for 4.0 planning on the dev list, besides the sun.misc stuff. Maybe since (gah AMAZON's Corretto, seriously we have to rely on AMAZON being a good steward of OSS) then the coordination of patching and providing builds has stabilized outside of Oracle offered downloads, but it was a bit unsettling for a while.

So while I get that a lot of people see that as "being nimble" and "moving fast", those are precisely NOT what Java has historically been, for better or worse.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @07:23PM (#26042918)
What you're describing is real in some places (Java's ecosystem also includes much/most of Apple, Netflix, Amazon, Google, Twitter, Uber and many others like them), but it is not a result of the new release model. The free support period of JDK 8 ended, like all versions before it, after five years. People who'd want to stay on 8 would have had to pay even if the release model stayed the same.

As to the changes, they aren't "near breaking." There have been few breaking spec changes, and they were very small. What breaks is what had always broken code: reliance on internal undocumented classes that change. The reason this happens more now than in the past is not due to spec backward compatibility -- we're as compatible as ever for most intents and purposes -- but because Java was stagnant for a good while, starting with Sun's dying days, and Oracle has been steadily increasing investment in the platform, which means more work done, which means more implementation changes. I think few would say this is a bad thing, but it also means that more code that does what it's warned not to do -- breaks. We're trying to stop this by turning on encapsulation in JDK 16, which would gradually stop libraries from hacking into the JDK and becoming stuck at any specific version.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by dcminter on Friday February 05, 2021 @11:34AM (#26038101)
As someone who very much felt the pain of stagnation in Java during the long release-cycles of the Java 5 to 8 era, I'm wildly enthusiastic about the new six-monthly release cycle.

Most of my clients use OpenJDK and don't pay for support of Java per se, so there are plenty of us outside the blast radius enjoying the benefits.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by dcminter on Friday February 05, 2021 @11:39AM (#26038170)
I can't find a reference off hand, but from following along the JDK-Dev mailing list the philosophy is not to remove sun.misc.unsafe until all the features are available in other public APIs. They're well aware of how important it is.

Hopefully someone else can chip in with a better reference or I can find an appropriate cite to back this up.

Edit: Ah, here's an example: https://openjdk.java.net/jeps/396

> It is not a goal to remove, encapsulate, or modify any critical internal APIs of the JDK for which standard replacements do not yet exist. This means that sun.misc.Unsafe will remain available.

Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by thom on Friday February 05, 2021 @02:17PM (#26040098)
It's a shame that Clojure only 'officially' supports the LTS versions. That is then reflected in what versions libraries and tools support so things seem to regularly break near the bleeding edge.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @03:21PM (#26040712)
The current version isn't the bleeding edge. It's the version most recommended for use in production. The bleeding edge is Early Access release. If things break for new versions, the root cause needs to be found, because this shouldn't happen if libraries target the spec.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by thom on Friday February 05, 2021 @05:32PM (#26042057)
I feel like the blood is in the eye of the beholder. When I upgrade JVMs and stuff in Emacs’s Clojure ecosystem breaks, that’s painful for me, and so I reflexively avoid doing that.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by daniel42__ on Friday February 05, 2021 @12:14PM (#26038590)
but whats happens if a feature i use gets deprecated in version 15/16?
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by pron on Friday February 05, 2021 @03:25PM (#26040748)
First, commonly used features aren't deprecated frequently. Second, you'd get a warning at least a year in advance (the more important feature -- the longer the warning). BTW, note that when something is removed from mainline, it is no longer maintained in Updates (because there are no more patches to the component to backport), and so it's not supported in "free LTS" offerings. If you want to continue using removed features for a few more years your only option is to buy long-term support.
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by daniel42__ on Friday February 05, 2021 @05:18PM (#26041942)
good point
Re:Talking to Postgres Through Java 16 Unix-Domain Socket Ch... by oweiler on Friday February 05, 2021 @08:50AM (#26036265)
There is no reason to use the LTS versions.