7 ms·
macOS 14.4 causes JVM crashes
- Anamon 3y agoAnother example for how preventing users from doing rollbacks is a terrible practice. Even if it's not your application's fault, users may have very good reasons to revert an update, if only temporarily. This also bothers me on Android. Sometimes, an app update may break something and prevent me from using it. But Google doesn't allow me to reinstall a previously published version from the Play Store. If I don't have to (or can't easily) do without that application until a fix might be released, my only option is to find an older release on some shady mirror site.
- tebruno99 3y agoIt is always funny to Me when Apple zealots come into threads blaming everyone but Apple that software broke. Complaining Java doesn’t follow Apple standards or some crap. Then 9 days later Apple issues a fix because they did indeed break it.
- w10-1 3y agoYes, you mean: https://support.apple.com/en-us/109035 https://support.apple.com/en-us/109035 Can you tell from this or any other Oracle bug whether Apple is bending its rules for Java? I can't tell either way.
- npalli 3y agoAn issue introduced by macOS 14.4, which causes Java process to terminate unexpectedly, is affecting all Java versions from Java 8 to the early access builds of JDK 22 If this affects so many versions of Java and nobody notices, is anyone even using Java on macOS?
- semiquaver 3y agoPlenty of people develop for java on macs. The issue is that per the article this behavior was not present in the early access macOS builds, which means something changed between beta and release.
- CharlesW 3y agoFor one, it doesn't affect all versions of Java. Java 20 (an LTS release) and 21, for example, don't have this problem.
- pritambarhate 3y agoJDK 21 is LTS not JDK 20. https://www.oracle.com/in/java/technologies/downloads/ https://www.oracle.com/in/java/technologies/downloads/
- bremac 3y agoPer the bug report, all versions since Java 8 are affected.
- CharlesW 3y ago> Affected Version: 8,11,17,21,22 This has changed (they added 21) since I posted the comment above, so it looks like they’re still getting a handle on it.
- grodriguez100 3y agoThe article says that the issue “is affecting all Java versions from Java 8 to the early access builds of JDK 22” now.
- karmakaze 3y agoI'm running RubyMine on 14.3.1 all the time and it's fine. Should I hold off updating to 14.4 until the dust has settled?
- merb 3y agoYou should I had some Rider and IntelliJ crashes. The crash does not happen often tough, but if your in the middle of writing code it can get you out of the flow.
- bzzzt 3y agoIt's not terminating directly. I've seen a few IDE crashes this week, less than one per day, but since there's no log there's no easy way to determine it's related to a macOS change.
- LgWoodenBadger 3y agoIntelliJ did this twice to me on Thursday and there was a crash log both times. I only reported one to Apple. Did you check the Console app for crash reports?
- Mustachio 3y agohttps://youtrack.jetbrains.com/issue/JBR-6802 https://youtrack.jetbrains.com/issue/JBR-6802 The JetBrains team has already figured it out as well.
- vips7L 3y agoReading the comments from David Wartell in that thread is enough internet for me today. This guy is CTO of some company and is just harassing the thread for a fix ETA without understanding the problem at all.
- deleted 3y ago[deleted]
- lanna 3y agoMaybe not a lot of macOS devs use Java, but a lot of Java devs use macOS
- seanalltogether 3y agoAlso, if you're a mobile developer you likely have a Mac, and if you're a mobile dev that doesn't target iOS exclusively, then you run java.
- re-thc 3y agoIf you use a Jetbrains IDE you already use Java e.g. Webstorm and Pycharm.
- latchkey 3y ago> is anyone even using Java on macOS? IntelliJ IDEA, the product itself, is JVM based.
- comonoid 3y agoIt broke since recent MacOS 14.4, even at 14.4 betas it worked.
- bombcar 3y agoMinecraft runs on various Javas. And there's a known issue with an interaction between minecraft, Java, and the video drivers that crashes out and it can be traced back all the way to here: https://github.com/glfw/glfw/issues/1997 https://github.com/glfw/glfw/issues/1997 It's not fixed.
- nurettin 3y agoSonoma has been out for only one week!
- stalfosknight 3y agoSonoma became generally available September 26, 2023.
- grodriguez100 3y agoHowever 14.4 was released days ago (March 7).
- stalfosknight 3y agoThe .4 is not what makes it Sonoma. The 14 is.
- grodriguez100 3y agoYes, I know.
- CharlesW 3y ago> "As a normal part of the just-in-time compile and execute cycle, processes running on macOS may access memory in protected memory regions." I'm just a lowly JavaScript/TypeScript/PHP programmer, but what is the Very Good Reason that Java trying to access other processes' memory?
- royjacobs 3y agoThe reasons are literally spelled out in the following paragraphs.
- CharlesW 3y agoI’m asking because the reasons seem dumb to me, which is why I’m asking people smarter than I am about low-level memory management if they’re legitimate.
- rzzzt 3y agoJIT compilation can happen at any time. The runtime wants to create a native version of a previously interpreted snippet of code when it is called frequently enough to warrant this. The article also describes W^X functionality, which means a region of memory is either executable (x)or writable. On macOS 14.4 violating this either-or condition results in a signal that can not be handled by the process.
- znafelrif 3y agoThe article doesnt say anything about the JVM accessing other processes memory though.
- mayoff 3y agoI don’t think the article claims that a Java process tries to access some other process’s memory. In a typical modern operating system, a memory page can be non-writable and non-executable, writable and non-executable, or non-writable and executable, but not simultaneously writable AND executable. If you generate executable code at runtime, then you need write access to a page to write the executable code into that page. Then you need to tell the operating system to change the page from writable to executable. If you then try to write to the page, you’ll get a signal (SIGSEGV or SIGBUS, according to the article). Oracle’s JVM apparently relies on this behavior: a Java process sometimes tries to write to a page (in its own memory space) that is not marked writable. The JVM then catches the SIGSEGV and recovers (perhaps by asking the operating system to change the page back from executable to writable, or by arranging to write to a different page, or to abort the write operation altogether).
- MaxBarraclough 3y agoIs the signals change in macOS likely to affect JIT-based systems other than the OpenJDK JVM?
- xyst 3y agoApple and macOS is slowly becoming another Windows in terms of stability. There was a HN post about a hashicorp founder using Linux within a vm on their mbp. Might adopt that same approach, if I can find the og post.
- open592 3y agoHere’s the YouTube link from Mitchell. I was thinking about doing something similar lately too. https://youtu.be/ubDMLoWz76U?si=ipmho73-r9FzZpBp https://youtu.be/ubDMLoWz76U?si=ipmho73-r9FzZpBp
- nullwarp 3y agoThis is what I do when my job forced me to use a mac. I think the only thing I installed on the mac outside of it was Firefox. Worked great for years before I changed jobs that let me bring my own hardware finally.
- neeleshs 3y agoWhat is your preferred hardware and flavor of Linux for this? I'm trying to do the same
- Kipters 3y agoTo be fair, this is the kind of breakage I'd expect from macOS, but never from Windows
- secondcoming 3y ago
- DuskHorizon 3y agoWell, that’s why Apple forbids use of private APIs in the App Store apps. If you built all your tech stack on the foundation of some peculiar nondocumented platform’s behavior, don’t be surprised when this stack breaks.
- bhawks 3y agoThis is not an API. It's the handling of writes to memory the process has protected. In the past this would generate a signal the process could handle and recover from. Now it generates a sigkill which is uncatchable / unrecoverable from. These behaviours have been historically well documented.
- DuskHorizon 3y agoAll system idiosyncrasies are APIs in the long run ;)
- fifteen1506 3y agoThe change of a SIGSEGV to a SIGKILL, seriously?
- DuskHorizon 3y agoAnd, why not? macOS is Apple’s IP and they have all rights to do with it as they want. Buy the way, Chrome/Node.js JavaScript engine uses JIT compilation too. Are they affected?
- samus 3y agoThis breaks POSIX compatibility, which is basically saying FU to how a lot of developers expect to interact with an operating system for decades now.
- jandrewrogers 3y ago
- olliej 3y agoA gross and low performance option for now might be to run Java under Rosetta, but I’m saying that based on them saying that this is apple silicon specifically and processes under rosetta have a bunch of quirks to support intel semantics. This would allow you to work around this for now. That said I’m curious what the exact scenario that leads to this is, I’m assuming it’s not common as you would expect it to have come up during betas and pre -release seeds.
- grodriguez100 3y ago> I’m assuming it’s not common as you would expect it to have come up during betas and pre -release seeds. The article specifically says that the issue was not present in early access releases, so it was not possible to discover it before the actual release.
- fwlr 3y ago“The Java Virtual Machine […] leverages the protected memory access signal mechanism both for correctness (e.g., to handle the truncation of memory mapped files) and for performance.” Where by “protected memory access signal mechanism”, they mean SIGBUS/SIGSEGV, i.e., a segfault. This is probably because the JVM is doing “zero cost access checks”, which is where you do the moral equivalent of: try { writeToFile() } catch(err) { if (err == SYSTEM_CRASH_IMMINENT) { changeFilePermissions() retry } } …because it’s faster than checking file permissions before every write. (It’s a common pattern in systems programming, so it’s not quite as crazy as it sounds.) I guess my opinion on this is that if you write your program to intentionally trigger and ignore kill(10) / kill(11) from the host OS, for the sake of a speed boost, you can’t really get too mad when the host OS gets fed up and starts sending kill(9) instead. I also wonder what happens in the (extremely rare) case where the signal the JVM is trapping is a real segfault, and not an operating system signal.
- dzaima 3y agoThis isn't about files, this is about plain pages of RAM[0]. It is a basic CPU operation to trap on unmapped pages, and OSes rightfully expose this useful feature (in addition to using it themselves), allowing processes to do many things, from lazily-computed memory regions to removing significant amounts of overhead doing a thing the CPU will inevitably do itself anyway. I believe the "the truncation of memory mapped files" section is for when the Java process memory-maps a file (as Java provides memory-mapping operations in its standard library, and probably also uses them itself), and afterwards some other unrelated process truncates the file, resulting in the OS quietly making (parts of) the mappings inaccessible. Here the process couldn't even check the permissions before reading (never mind how utterly hilariously inefficient that would be, defeating the purpose of memory-mapping) as the mappings could change between the check and subsequent read anyway. [0]: https://bugs.java.com/bugdatabase/view_bug?bug_id=8327860 https://bugs.java.com/bugdatabase/view_bug?bug_id=8327860, "I've managed to narrow this down to this small reproducer:" section
- fwlr 3y agoYou are of course completely correct. However, I still stand by my pseudocode - I claim that it will give a fairly accurate impression of the basic concept of zero-cost access checks to a reader who isn’t familiar with low-level systems programming. (That said, I have updated my comment to make it clear it’s more of a metaphor than a literal description.)
- riscy 3y ago> macOS on Apple silicon processors (M1, M2, and M3) includes a feature which controls how and when dynamically generated code can be either produced (written) or executed on a per-thread basis. […] With macOS 14.4, when a thread is operating in the write mode, if a memory access to a protected memory region is attempted, macOS will send the signal SIGKILL instead. This isn’t just any old thread triggering SIGKILL, it’s the JIT thread privileged to write to executable pages that is performing illegal memory accesses. That’s typically a sign of a bug, and allowing a thread with write access to executable pages to continue executing after that is a security risk. But I know of other language runtimes that take advantage of installing signal handlers for SIGBUS/SIGSEGV to detect when they overflow a page so they can allocate more memory, etc. This saves from having to do an explicit overflow check on every allocation. Those threads aren’t given privilege to write to executable memory, so they’re not seeing this issue… So this sounds like a narrow design problem the JVM is facing with their JIT thread. This blog doesn’t explain why their JIT thread needs to make illegal memory accesses instead of an explicit check.
- Reason077 3y ago> "This blog doesn’t explain why their JIT thread needs to make illegal memory accesses instead of an explicit check." Because explicit checks on every memory access (pointer dereference) makes Java significantly slower, even with compiler optimisations to remove redundant checks[1]. Memory protection is a fundamental, very useful, hardware feature and it's perfectly reasonable for user space language runtimes to take advantage of it. Or, to put it another way, SIGSEGV has been a part of Unix-family OSes for decades. It works perfectly fine on Linux and Windows and there's no reason it shouldn't work on macOS. [1] (Many years ago I worked on a cross-platform implementation of the Java runtime and wrote much of the threads and signal handling code. We had an option to enable explicit memory checks, which got us up and running faster on new platforms where the SIGSEGV handlers hadn't been written yet. From memory this made everything something like 30-50% slower, so it was definitely worthwhile to implement SIGSEGV handling. In our case SIGSEGV handlers were used both as part of the garbage collector/memory management and to implement Java's NullPointerException)
- beeboobaa 3y agoIf something works on OS release version 1 then it should still work on OS release version 2. Or in apple vernacular, it should just work.
- ivan_gammel 3y agoI wonder if it's the same reason as why Civilization 6 stopped working on iPadOS 17.4. Did they change something deep in the kernel for DMA compliance?
- INGSOCIALITE 3y ago[flagged]
- zx8080 3y agoThe main question now is why hasn't it been exposed in pre-release 14.4. This could mean some very urgent and risky change got its way to the 14.4 release, or that the whole macos release process is broken and unstable.
- 8crazyideas 3y agoI just bought a MacBook Pro with the M3 Max chip and installed MATLAB R2023b. Sonoma 14.3 is in place. As a requirement, I had to also install Corretto 8. MathWorks only supports the Java 8 JRE included with Amazon Corretto 8. I am already having several problems in MATLAB with his new setup. Can I assume that updating to Sonoma 14.4 might very well cause even more problems? I really don't understand any of this.
- dimask 3y agoI would not update for the time being. If it works it will probably break, if it is broken it may break more. Btw what sort of problems are you facing? I have had problems with closing figures, but figured it out eventually with a workaround [0]. [0] https://se.mathworks.com/matlabcentral/answers/2027964-matlab-crash-on-sonoma-macos-14-0#answer_1369044 https://se.mathworks.com/matlabcentral/answers/2027964-matla...
- xcv123 3y ago".. is affecting all Java versions from Java 8 to the early access builds of JDK 22. There is no workaround available .." Do not update until Apple fixes the issue.
- ls612 3y agoIs it Apple or Oracle who should rightly be fixing this issue?
- xcv123 3y agoIt's a bug in macOS and it breaks POSIX compliance. Oracle can develop a workaround but Apple should fix it in their next update.
- sunshinerag 3y agobug? POSIX compliance? How?
- pier25 3y agoAmazing that Apple introduced a breaking change in a .4 release. Probably a mistake? Also amazing it wasn't caught during the beta period.
- mvdtnz 3y agoThis kind of behaviour is very common from Apple.
- goosedragons 3y agoIt wasn't in the public beta according to Oracle.
- empthought 3y agoApple has never been a follower of semantic versioning.
- lloeki 3y agonitpick: Apple doesn't follow SemVer 2.0, but they do have a semantic versioning scheme, that is, the version components carry a certain semantic, it's just so that this semantic is different than the semantic defined by the SemVer 2.0 specification. One can have any sort of semantic versioning that is not SemVer 2.0 compliant and still be useful, see e.g Rails or Ruby. Even .Net assemblies are not SemVer 2.0 compliant: their pattern is maj.min.patch.build but SemVer 2.0 specifies that there can only be three conponents and build info must be behind a plus, like maj.min.patch+build
- tiffanyh 3y agomacOS dark ages. I wonder if we’re about to enter 4-5 years of macOS “dark ages”, due to Apple grappling with EU/DMA. Much like Microsoft in early 2000s, between IE/lawsuit and grappling with internet security/viruses. Windows XP, launched in 2001, was considered by most a great OS, didn’t have another good OS successor until 8-years later (Windows 7).
- mdhb 3y agoIt’s not at all like they didn’t have the time or the resources to deal with this. I think we already saw some of this in particular with the recent bullshit they tried to pull with PWAs in iOS 17.4 that they were hoping to just let things break and were hoping that they could shift the blame and anger towards the EU instead.
- javajosh 3y agoIt seems highly unlikely that the macos people don't test anything on the jvm during acceptance. It's even more suspicious that this change didn't happen during the public beta. Is it possible that Apple is firing a warning shot at Java? Even as a huge fan of Hanlon's razor, this seems like such an enormous oversight its hard for me to ascribe it to incompetence.
- flohofwoe 3y ago> it seems highly unlikely that the macos people don't test anything on the jvm during acceptance. I would be surprised if they do to be honest (Apple doesn't even catch obvious bugs in the new macOS settings panel, which really makes me wonder if there is a software QA process at all). For 3rd party apps they seem to rely on the software vendors to holler if a macOS update breaks their app. That's why the macOS prerelease versions exist. But since the bug wasn't present in the prerelease, affected vendors couldn't catch it. It's still a fuckup in Apple release process of course (which tbh also isn't surprising).
- wyclif 3y agoWhat is the bug in the new System Settings panel?
- overstay8930 3y agoNo idea what OP if referring to but I could pretty consistently cause Settings to soft lock for a few months by loading a configuration profile while the settings window was open, just small things like that are basically everywhere in macOS. Don't even get me started on Screen Time bugs...
- flohofwoe 3y agoI'm stumbling over a couple of annoying problems when opening the DNS server subpanel via search (because without search it's pretty much impossible to find that panel, but that's a separate issue). One is that occasionally there's an error popup "Extension process Network(4433) exited." just when clicking on the 'DNS servers' search result. The other is that when accidentally hitting "Enter" after entering a new DNS server address the entire DNS Server subpanel will close even though I want to enter a second address (which sucks from a user perspective, but might even be consistent with the UX guidelines, but OTH I would expect pressing Enter on a text input box would not close the UI panel which contains the text input box, but maybe that's just me). But then clicking on the previous search result 'DNS servers' to open the DNS servers panel again, the click does nothing this time. One has to clear the search box, enter the search term again, perform a new search, and then click the search result 'DNS servers' again to get the subpanel for entering DNS server addresses. I guess the search is also broken like this for other subpanels, but changing the DNS servers is about the only situation where I'm using the search box. In the old settings panel all that worked as expected (and apart from that, everything also was a lot snappier, somehow Apple engineers managed to create simple Settings window that suffers from performance problems, but again, different issue).
- w10-1 3y ago"The issue was not present in the early access releases for macOS 14.4, so it was discovered only after Apple released the update." I wonder if Oracle really didn't know beforehand. Apple has long been telling people (writing JITs) that to write to executable memory, they need the correct entitlements (com.apple.security.cs.allow-jit, allow-unsigned--executable-memory, and or/ .disable-executable-page-protection). I wonder if Oracle has been ignoring them, satisfied with the signal-handler workaround, and Apple finally enforced their policy. Apple also expects that developers deploying apps on MacOS that use Java have these entitlements configured on a per-app basis. Oracle likely objects that this is not really for the application developer to certify, since it's pretty much out of their control. In any case, I'm doubting Oracle's release is the whole truth.
- vips7L 3y agoThis is honestly a wild and out there claim. The OpenJdk team would never want to see this happen to their user base. They’re some of the most professional programmers I’ve ever seen. The whole truth is that the Apple kernel team broke user space.
- kaba0 3y ago> Apple has long been telling people (writing JITs) that to write to executable memory, they need the correct entitlements (com.apple.security.cs.allow-jit, allow-unsigned--executable-memory, and or/ .disable-executable-page-protection). I wonder if Oracle has been ignoring them, satisfied with the signal-handler workaround, and Apple finally enforced their policy. As far as I understand, that’s not the issue, the JIT itself works just fine. The JVM just uses the (quite common) trick that it doesn’t actually bound check everything, but let’s the hardware trigger an interrupt, expecting that to “bubble up” to the program at hand, so it can handle certain cases “for free”. This behavior was changed by apple, which causes issues.
- exabrial 3y agoWhy not just let it bubble up from the hardware? Seems like a redundant thing to build into the kernel
- sunshinerag 3y agoconsidering macOS is doing the right thing, shouldn't the title read JVM crashes on macOS 14.4 ?
- metanonsense 3y agoEven if this was the right thing, they could / should have changed this behavior in a pre-release because that's exactly the kind of API change in the OS that will catch people off-guard. As another commenter wrote, I'd consider this either a serious flaw in Apples release process or they learned about some very dangerous vulnerability where the old behavior was abused and they decided that they rather annoy all users and vendors of Java software out there than tolerate the vulnerability in MacOS. But in this case I'd surmise that at least now Oracle would have been informed about this.
- not_me_ever 3y agoWait, they write to protected memory, and get killed. :tripplefacepalm: Somebody hire some engineers at Oracle.
- erik_seaberg 3y agoTo finish validating a request and then start executing it creates a race condition. That's why execution always needed to fail in a recoverable way.
- kaba0 3y agoSarcasm only works when you are actually smart and know what you are talking about.
- millzlane 3y ago14.4 also killed automated device enrollment in VMware's workspaceone. We're having to downgrade brand new MacBooks to 14.3 using configurator.
- sebazzz 3y agoIsn't this just W^X?