ByteCode.News
Submit RSS Atom Sign in

Back to the channels

#java

  1. ferret guys i need your help
  2. ferret we cant end LTS Java
  3. ferret i need a community
  4. ferret i know its 3 years but EOL
  5. ferret please
  6. ernimril uh? what?
  7. ferret https://developers.slashdot.org/story/26/06/14/0534214/four-lts-java-versions-get-end-of-support-in-a-three-year-window-2029-2032
  8. javabot ferret's title: "Four LTS Java Versions Get End-of-Support in a Three-Year Window (2029-2032) - Slashdot"
  9. ernimril if you can not get off of java 8 until 2030 you do have a problem, but the support for java aint one of them
  10. ferret please its important
  11. Harzilein you need a community -> you need external consultants but those need oversight?
  12. ernimril well. this channel has nothing to do with oracle and its plan for LTS
  13. ferret im scared
  14. Harzilein try #psychology?
  15. ferret it will protect critical infrastructure against vulnerabilities while minimizing the risks and costs associated with frequent disruptive code migrations
  16. ferret its so important
  17. ferret i cant do this alone
  18. ernimril ferret, what jvm are you currently using? oracle? openjdk? adoptium?
  19. comrad if he needs LTS then he simply should pay oracle
  20. comrad did he expect that someone here volunteers? :)
  21. Para I wish someone paid me to learn why hanging onto an old LTS is worth getting anxious about on Sunday.
  22. Drixtan god I love the humour of this channel
  23. dreamreal I love how peopple say "help me" withput saying what that help means
  24. dreamreal THAT guy's answers were clear
  25. dreamreal based on what he was saying, but he never actually said
  26. dreamreal comrad:
  27. dreamreal comrad: he has other options, too: cheerpj, azul, oracle as was suggested
  28. dreamreal he was far from "oh no nothing will work" even if he needs specific maintenance support
  29. comrad dreamreal: sure, but oracle would be the google search first result probably
  30. dreamreal oh, definitely. And what he REALLY should do is what was suggested: move off of EOL
  31. dreamreal There are so many benefits to doing so that it makes no sense to stay on older versions
  32. dreamreal the only thing that really hurts that is the securitymanager
  33. comrad sometimes some certification stuff keeps you on that pinned version
  34. dreamreal Sure, can see it, but ... got any examples?
  35. Para I'm kinda interested about the whole thing. In an anthropological sense, that is. Why some places can't see why updating versions would be sensible, what's the fallacy/fear. There's always some reason, but rarely it's about the tech itself.
  36. dreamreal Yeah, although I *do* want to figure out the security manager thing
  37. dreamreal I get that it was rarely used by the hoi polloi, but ... I mean...
  38. dreamreal so now I can just write a servlet that calls System.exit()?
  39. Para App I'm working on has that as REST endpoint!
  40. Para Yes, it has admin account permission check around it, but still...
  41. dreamreal System.exit() is only the worst offender
  42. dreamreal how do things like glot.io expect to prevent filesystem access, network access, exit access outside of an isolated VM? That's the smart play ANYWAY, I guess, but those isolated containers ain't exactly security fortresses either
  43. Para Seems that's a nix based service, so I suppose they're heavily relying on immutable fs being the magic wand.
  44. Para (figured this out by printing System/getProperties and System/getenv...yeah not a good sandbox)
  45. comrad dreamreal: i supported and developed an application that was certified by the german calibration office which included the working environment. and the jvm was part of that. So we could not change it without recerficiation - certification was valid for 10 years
  46. comrad dreamreal: otherwise aviation or medicine maybe? but then he should already know what their boundaries were and how to mitigate them by buying support from a company
  47. dreamreal Aviation can't be java, I am not sure medicine can either
  48. dreamreal I've got code on planes, but it's not aviation code
  49. dreamreal (I've deployed java in medicine, too, but that's not on medical devices, for the same reason)
  50. Drixtan dreamreal: cannot be on aviation / medecine (devices), why are you saying that? because of the GC STW?
  51. dreamreal no, because the executable code isn't the same as the deliverable code
  52. dreamreal in aviation you verify every executable path, period
  53. dreamreal you could use non-JIT java for that purpose if you wanted but why
  54. Drixtan I didn't know that, that's interesting
  55. dreamreal You really don't want the software that controls your ailerons to be unpredictable in *any* way
  56. dreamreal same for the software regulating your heartbeat
  57. Drixtan but C code is predictable in *all* cases am I right...
  58. dreamreal Analysis, entertainment, sure, whatever. But when you depend on dropping control rods into a nuclear pile, you, uh, don't want the compiler to go "oh wait, that wasn't the happy path"
  59. dreamreal well, C doesn't recompile on the fly: when gcc emits linked code, what you run is what you delivered
  60. Drixtan hear me here, I am just trying to understand. But in what case, with all the UB, or potential memory management mistakes that are possible in C, how comes C is "predictable" where the JIT is not? In what circonstances the JIT would be "unpredictable" on your javacode, when you "emitted" your bytecode, that's what is going to run/delibered.
  61. dreamreal Java's written in C, so it's obviously *doable*, but not normally. There are, as usual, tradeoffs for everything: writing code that performs excellently in Java takes less effort than the same code in C, but C is *more predictable*, which is why I have a relatively low opinion of most rank and file coders
  62. dreamreal the metrics people use to judge environments are often stupid
  63. dreamreal "but it's go so many lines of code, it's so verbose, C is faster" ... uh
  64. dreamreal I get it, but think for just a few minutes before speaking, it really does help
  65. Drixtan how insulting me helps the situation here?
  66. dreamreal Did I insult you?
  67. Drixtan "think for a few minutes before speaking" <- that sounds like an insult, barely "you said something stupid" kind of thing
  68. dreamreal Bytecode doesn't run very often. It gets JIT-compiled and reanalyzed all the time.
  69. dreamreal Drixtan: did you say something stupid, though?
  70. dreamreal I mean, wouldn't that be part of the equation?
  71. Drixtan well, I am asking, did I ask something stupid?
  72. dreamreal I didn't say you did, so do the math
  73. dreamreal and unpredictability on the part of the *programmer* is not the same as unpredictability on the part of the *deliverable*
  74. dreamreal if you have a malloc(), a usage, a free(), that is *absolutely* traceable
  75. Drixtan anyway, back to it then - the JIT compiled is reanalyzed all the time, I don't see it becomes less predictables still
  76. dreamreal and if that usage is remarkably complex, involving 4M of executable code, it's STILL traceable because it doesn't mutate at runtime, period, unless the programmer does that specifically
  77. Drixtan the 1+1 will and always be 2, jit, bytecode / or binary on a platform XYZ
  78. dreamreal Drixtan: you're measuring outcomes, not process
  79. dreamreal in C, if you do a BCD 2+2, you've got representations that work *that way* - BCD, BCD, addition, outcome is BCD
  80. dreamreal At runtime the compiler is never ever ever going to go "oh, haha, this is bigdecimal, but it's always integer math, let's optimize for integer math and make it take 3 cycles instead of 432"
  81. Drixtan https://www.gnu.org/software/c-intro-and-ref/manual/html_node/Optimization-and-Ordering.html
  82. Drixtan the code can totally be re-ordered
  83. dreamreal and THAT optimization is flexible (check!) and occasionally unpredictable (check!) and MIGHT BE WRONG (check! What happens if the input is integral 99,999 times out of 100k?)
  84. dreamreal Drixtan: and ... when
  85. dreamreal when is that reordering done?
  86. Drixtan compilation said
  87. dreamreal and when is Java's reordering done?
  88. Drixtan well, quoting you: 08:57 dreamreal no, because the executable code isn't the same as the deliverable code
  89. Drixtan in both cases, dliberable code = pre-compilation
  90. dreamreal Drixtan: so what's your point? You're saying the same thing I'm saying, I'm sayingit's actually meaningful
  91. dreamreal reordering at compilation time before delivery != reordering at RUNTIME compilation time
  92. dreamreal and java reorders multiple times
  93. Drixtan it's not once JIT it's jit for good?
  94. dreamreal java delivers bytecode; C delivers executable code
  95. dreamreal Drixtan: no, java recompiles constantly
  96. Drixtan that was the part missing in my understanding I believe
  97. dreamreal if you have code with two paths and one path is run most of the time, it optimizes for that path... but if at runtime the happy path CHANGES it will recompile for the other path
  98. dreamreal now imagine that over the *entire application library*
  99. dreamreal generally predictable, sure, but absolutely predictable, god no
  100. dreamreal and in flight, medical, energy code you DO NOT want code to take 16 cycles here, 64 cycles there
  101. dreamreal you want to know
  102. Drixtan or a STW
  103. Drixtan right in your peacemaker, can't miss a beat isn't it
  104. dreamreal WHat's a STW?
  105. Drixtan stop the world
  106. dreamreal Well, Java wouldn't MISS THE BEAT but it'd be less predictable in terms of time. JME could do it as it has no GC and no JIT (constrained devices) but JME is heavy when alternatives exist
  107. Harzilein hmm
  108. dreamreal STW is controllable in a lot of ways, it's hardly the bogeyman it was for java 1.2
  109. dreamreal some VMs even have "you will not STW for longer than this period" options
  110. dreamreal and some don't have STW at all, plus you can select which GC strategy you want
  111. Drixtan oh, I did not know the STW was deterministic, or could be deterministic
  112. dreamreal GC is definitely a thing to watch, but they've had different strategies for it since 2002
  113. dreamreal still an issue, like I said, I had to fix a GC issue at work a few weeks ago in the year 2026 CE, which feels slightly crazy to me, but hey
  114. Drixtan and having different strategies is making it predictable, or at least, there is a strategy so it is predictable...
  115. dreamreal well, it's optimizable
  116. Drixtan ah ok, so when I asked first if it was because of the STW and you answered no, it was actually "yes" ?
  117. dreamreal No, it wasn't. Our problem wasn't STW.
  118. dreamreal A STW issue is almost always remedied by changing a few strategies. In our case, it was 20 minutes of work to fix a problem that had gone ignored for years.
  119. dreamreal (Write tests, people. Focused tests. And pay attention to your effing results. Grrr.)
  120. dreamreal We had a cartesian expansion of memory consumption: not STW GC, but OOME... vs a 2000% increase in TIME consumption
  121. dreamreal and since that process was the last step in a long chain of events, the time consumption was handwaved off
  122. Drixtan that's a specific case, an anecdote, I wasn't talking about that case.
  123. dreamreal "this takes 40m, sounds right" when, well, okay, it should have taken 35m, nanometers are still *this* long
  124. dreamreal sure, but it's a generalizable anecdote, STWs are not common in modern VMs
  125. dreamreal you could create a problem with STW GCs if you tried hard enough. Quick, what would you have to do?
  126. dreamreal hold on, give me a minute, I need to figure out what an actual answer would be
  127. dreamreal I tried thinking of a few scenarios already but ... nah, they'd be easily addressed without tuning a single damn thing
  128. dreamreal striping long-retained information while heavily over-allocating at the same time, AND choosing the wrong GC model... CCMS? No, that'd be fine
  129. dreamreal it'd be slow, but fine, unless maybe you VERY heavily overthreaded at the same time...
  130. Drixtan at one point, you have to clean up the allocated objects no? isn't that a stw
  131. dreamreal no
  132. Drixtan oh, how does it unallocate the heap then
  133. dreamreal by not having a "the heap"
  134. dreamreal that's not been a thing since java 7
  135. Drixtan creating an arraylist, adding stuff in it doesn't go in the heap
  136. dreamreal sure, but you have now said "the heap" multiple times, and that's not how memory works in the VM
  137. Para Lucene internals is apparently very interesting if you want to learn how to deal with near-zero allocation code in JVM.
  138. dreamreal there is a "the heap" but "the heap" has multiple regions to work with
  139. Drixtan ok, because you just said "not having the heap"
  140. Drixtan that's not been a thing since java 7
  141. dreamreal I said "the heap" with the definite article being very much an important part of the phrasing
  142. Drixtan so I guess, since java 8 there is "no heap"
  143. dreamreal Sure, there's a heap, there are actual MANY heaps
  144. dreamreal even on java 1 there were multiple REGIONS
  145. dreamreal cleaning up some of those regions WAS a STW
  146. Drixtan ok, and that "non heap heap" isn't cleared by the gc
  147. dreamreal but that model hasn't been dominant or default (or AVAILABLE) in the VM for years now
  148. Drixtan or aka, the stw
  149. dreamreal no, it's always...
  150. dreamreal *sigh*
  151. dreamreal Drixtan: okay, let's peer through history, back to a bygone age: memory was in four regions.
  152. dreamreal THIS IS NO LONGER THE CASE, okay?
  153. dreamreal But there were four regions: short term, survivor, two long-lived regions
  154. dreamreal you could instant-allocate the sizes by using -client and -server for the java process; server got really large generational spaces and a relatively small eden, client got a giant eden with relatively small generational spaces
  155. dreamreal STW is when those generational spaces had to be cleaned up, because eden got swept instantly and quickly but those generational spaces had to be checked thoroughly
  156. dreamreal now let's go to ... oh... 2007.
  157. dreamreal Now the eden space still exists but the generational regions *exploded*. They're smaller, because they're sized by the GC: you have 20G of RAM? Cool, maybe you have 20 regions now.
  158. dreamreal ("Maybe" is important, because YOU CAN CHOOSE THE GC STRATEGY you want and they change from VM to VM.)
  159. dreamreal so if you have 20 regions to clean up, for one thing the GC runs as a thread, plus it only cleans up 1G at a time when that region gets crowded - and it usually does so by blitting things out at need and then just wiping that section, which is really fast
  160. dreamreal STW would happen in catastrophic circumstances when you fill up EVERY region with worst-case stuff
  161. dreamreal it's not going to happen casually
  162. dreamreal also worth noting: the GC stuff is written by some of the smartest programmers on earth, people whose shoes I am not fit to shine
  163. Drixtan when allocating something new, it goes in eden?
  164. dreamreal ... usually
  165. Drixtan where else if it's a new allocation?
  166. Drixtan anyway, so when eden is full, what is happening? filtering what is to keep, what is not to keep, and pushing what to keep in an older generation "section" ?
  167. dreamreal depends on size: the thing king might say "this is eating up a lot of room in eden, let's put it elsewhere out of the gate" because the programmer decided to allocate an arraylist with 4m slots
  168. dreamreal that is what happens, yes
  169. Drixtan don't you have to stop new allocations to happen so nothing happen new to eden?
  170. dreamreal no
  171. dreamreal it's still using threads: copy stuff out, deallocate teh region. Eden is not large on purpose.
  172. dreamreal Is free() slow?
  173. Drixtan yea, but don't you have to stop new allocations thou?
  174. Drixtan thread, copy stuff, great, but -allocations-
  175. dreamreal for the VM, it's just memcpy() and adjust pointer refs
  176. dreamreal stuff still has to happen, sure, but it's *fast*
  177. Drixtan ok, but you have to stop new allocations to eden
  178. dreamreal if it's not, well, that's why linux and BSD and windows are so slow: turns out doing stuff still requires teh speed of light to be respected
  179. dreamreal you... don't
  180. Drixtan so during the change to older generations and cleanup of what to be cleaned, you do not stop new allocations happening to eden when you cleanup eden
  181. dreamreal right
  182. dreamreal what programming languages are you familiar with?
  183. Drixtan C
  184. dreamreal okay. You know how processes work in C, yeah?
  185. Drixtan yea
  186. dreamreal okay, imagine that instead of malloc() you have a process that does the allocation/free/access for you
  187. dreamreal (like a multithreaded malloc(), salloc(), free(), calloc())
  188. dreamreal you're just dispatching to something that calls you back when it's done WHATEVER, right?
  189. dreamreal That's the memory manager for every OS, for what it's worth, except the JVM has its own representation of it
  190. dreamreal and I gotta run
  191. dreamreal have a good one, all!
  192. Drixtan reading this: https://docs.oracle.com/cd/E19900-01/819-4742/6n6sfgmkr/index.html I think it says something like: "The frequent young space collections are quick (a few milliseconds)" suggesting a pause and for your CMS you mentionned: Other GC algorithms, such as the Concurrent Mark Sweep (CMS) algorithm, are incremental [...] high probability of small pauses
  193. javabot Drixtan's title: "Managing Memory and Garbage Collection (Sun Java System Application Server Enterprise Edition 8.2 Performance Tuning Guide)"
  194. nevet Managing Memory and Garbage Collection (Sun Java System Application Server Enterprise Edition 8.2 Performance Tuning Guide)
  195. Drixtan all this seems to suggests there is a pause anyway
  196. Para Depends on GC algorithm.
  197. Para That page is from 2010 so it might be a tad outdated :)
  198. Para https://www.javacodegeeks.com/2026/04/the-jvm-garbage-collector-decision-in-2026-g1-vs-zgc-vs-shenandoah-for-real-workloads.html
  199. Para PermGen got replaced with Metaspace in Java 8, Java 9 made G1 the default, 15 brought in concurrent low-pause algos... Also different JDK distributions may have different GC algos as well.
  200. Drixtan ok, I see 3 GCs here and in the table, they all have "pauses"
  201. Drixtan so, to come back to the initial question "why not in aviation / medical devices", the STW still present here
  202. Drixtan there is no case where there is no STW
  203. Drixtan if we keep the focus on the initals
  204. Para Well, kinda yes. Modern algos minimize the pauses and generally do the cleanup in different threads etc. so unless you're introduing tons of memory pressure it should be effectively unnoticeable.
  205. Para Of course planes are the kind of devices where "effectively" isn't good enough :)
  206. Drixtan the point is not if someone notice, the point is there /is/ one pause
  207. Para JVM guarantees allocation, or rather the code can never proceed beyond "new" unsuccesfully. It can get stuck and throw OutOfMemoryErrors and whatever, but it won't progress or -I think- deadlock either on "new".
  208. Para Stuckness usually is the GC algo panicking because it can't do its work to free enough space for the allocation, so it'll grind to halt and then OOMEs, but from human point of view it gets stuck.
  209. Drixtan yea, but even on a good day, you have some pauses, that's a normal jvm/gc behaviour and it's not acceptable when realtime is a requirement
  210. dreamreal and again, as I drive by, STWs are not "the reason" - it's predictability of the runtime code as the primary lever, because there are heap managers that are zero-allocations, so no STW because there's no cleanup
  211. Para I don't think any of us are in disagreement here?
  212. Drixtan no, it's not a "you are right I am right, we are wrong", like I said; hear me out here, I want to understand
  213. Para There at leats used to be some very specific constraints (hw+sw+os+version) to have realtime Java but I'm fairly certain that's from a bygone era.
  214. Drixtan I have something else to do than winning an argument, but if I want to understand, I need it to be clear and not just take words for it
  215. Drixtan if that makes sense to you
  216. dreamreal that's not what realtime means: realtime is not "is slow," realtime is "will occur in this timespan"
  217. dreamreal realtime can be "350ms" if the 350ms is guaranteed
  218. Drixtan I never said that realtime = slow
  219. Drixtan whre did I say that
  220. dreamreal you did not. I was clarifying, because a "STW that runs in 350ms" is acceptable in realtime terms if the SLA allows it.
  221. dreamreal STW is not the problem, like I keep saying.
  222. dreamreal And it's worth noting that realtime != fast
  223. dreamreal "realtime" makes guarantees about time, but does not make an assertion about what those guarantees ARE except for the specific circumstances of deployment
  224. yamada where is all remote method invocation documentation in java 26
  225. Bombe In the EU, medical software is a medical device, too, according to 2017/745 Medical Device Regulation, so technically, medical devices can run on Java. :)
  226. Bombe (But for hardware, it is pretty much 100% as dreamreal says.)
  227. Para Our company has one (and two in progress) medical device certified applications.
  228. Para And yeh, it's a JVM app.
  229. Bombe Yeah, I’m working on one as well. :)
  230. Para It basically does some statistical data digging on input and gives a ranking of how certain certain decisions could be data wise.
  231. Para "78% of people with these issues respond well (3.8/5 on quality scale) to this treatment"
  232. Para The wording afaik was almost the hardest part to get right, as the software is not allowed to tell "give them ibuprofen end yeet the patient" or any other direct recommendations/advice.
  233. Drixtan I made a prescription "giver" on pda back then, so the doctors could walk to the patient, prescribe directly from the pda and print it on thermal paper, give it right away and move on
  234. Bombe Yeah, we’re analyzing hardware recordings and make it easy to diagnose stuff, but we don’t do the diagnosis, that’s the user’s job.
  235. Drixtan java version old-something
  236. Para 1.enough
  237. Drixtan kind of :)
  238. gaxar Hello. I have a question. Is it necessary to learn how type erasure works when learning Java?
  239. Para I'd say yes, but it's not hard.
  240. gaxar Oh okay.
  241. Para It's all just Objects.
  242. gaxar Well, I struggle to read and concentrate a long time. So, I just practiced upperbounded wildcards, and the guidelines on whether to use upperbound or lowerbound. Then, while reading about type erasure, I felt resistant to the activity and stopped.
  243. gaxar I don't know why, but I get tired easily.
  244. Para Get rid of your smartphone.
  245. Para Also that stuff is not very common in practice.
  246. gaxar Oh.
  247. gaxar Why not?
  248. Para Good to know but not by heart; just know where to read to refresh your memory when needed.
  249. gaxar ok.
  250. gaxar What makes you think my smart phone is the problem?
  251. Para Most people just use simple generics, MyType<T>. Also type erasure just means that during runtime every generics is Object and the necessary casts are done on the background.
  252. gaxar Okay.
  253. gaxar Thank you.
  254. avu I can't remember when I last wrote an upper or lower bound wildcard in Java and I still write Java almost every day :o
  255. Para gaxar: Process of elimination, most people have fried their brains these days with the insta-dopamine trickling provided by all the shit social media etc :)
  256. gaxar oh.
  257. Drixtan or AI
  258. Drixtan learning new stuff/concept IS tiring too, so do not blame yourself and keep going ;)
  259. Para It feels tedious because learning _is_ tedious. You're literally feeling yourself learning.
  260. gaxar I don't go on social media most of the time, but I keep scrolling through my news feed on google and the home media page on Android.
  261. avu trying to diagnose why somebody gets easily tired from a few sentences on IRC is a bit wild :)
  262. gaxar ok
  263. Para avu: I'm not a certified medical device.
  264. gaxar ok
  265. avu good to know 8)
  266. gaxar Well, thanks for the information.
  267. gaxar I'll probably be back later.
  268. jreicher Drixtan: I think maybe you misunderstand what "predictable" means. Consider a pseudo random number generator. In principle it's predictable because it's entirely deterministic, but in practice it's not because its behaviour is infeasibly complex, which is largely the goal of it. So predictability is more about simplicity than anything else. You have to decide whether the JVM is sufficiently simple. But it should be uncontroversial to
  269. jreicher say that when you are in control of the entire runtime, as is the case writing in C, you can make things as simple as you want.