Re: [jdk18] RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2022-03-09 Thread Roman Kennke
On Wed, 9 Mar 2022 13:11:27 GMT, Roman Kennke wrote: > Hi all, > > This pull request contains a backport of commit > [8eb453ba](https://github.com/openjdk/jdk/commit/8eb453baebe377697286f7eb32280ca9f1fd7775) > from the [openjdk/jdk](https://git.openjdk.java.net/jdk) repository. > > The commit

Re: [jdk18] RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2022-03-09 Thread Roger Riggs
On Wed, 9 Mar 2022 13:11:27 GMT, Roman Kennke wrote: > Hi all, > > This pull request contains a backport of commit > [8eb453ba](https://github.com/openjdk/jdk/commit/8eb453baebe377697286f7eb32280ca9f1fd7775) > from the [openjdk/jdk](https://git.openjdk.java.net/jdk) repository. > > The commit

[jdk18] RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2022-03-09 Thread Roman Kennke
Hi all, This pull request contains a backport of commit [8eb453ba](https://github.com/openjdk/jdk/commit/8eb453baebe377697286f7eb32280ca9f1fd7775) from the [openjdk/jdk](https://git.openjdk.java.net/jdk) repository. The commit being backported was authored by Roman Kennke on 10 Dec 2021

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v8]

2021-12-10 Thread Roger Riggs
On Tue, 7 Dec 2021 10:42:50 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v8]

2021-12-10 Thread Roman Kennke
On Fri, 10 Dec 2021 14:44:07 GMT, Kevin Rushforth wrote: > This is a P4 bug. If the priority is correct, it does not meet the criteria > to get it into JDK 18 during RDP1, as indicated in [JEP > 3](https://openjdk.java.net/jeps/3). > > If this is objectively a P3 bug, and really does need to g

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v8]

2021-12-10 Thread Kevin Rushforth
On Tue, 7 Dec 2021 10:42:50 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v8]

2021-12-10 Thread Roman Kennke
On Tue, 7 Dec 2021 10:42:50 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v7]

2021-12-07 Thread Roman Kennke
On Tue, 7 Dec 2021 06:23:22 GMT, Peter Levart wrote: >> Roman Kennke has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Fix cast; add testcase to cover memory pressure > > test/jdk/java/io/ObjectStreamClass/TestOSCClassLoaderLeak.java line

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v8]

2021-12-07 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v7]

2021-12-06 Thread Peter Levart
On Mon, 6 Dec 2021 12:12:44 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v7]

2021-12-06 Thread Roger Riggs
On Mon, 6 Dec 2021 12:12:44 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v6]

2021-12-06 Thread Roman Kennke
On Sat, 4 Dec 2021 08:47:03 GMT, Peter Levart wrote: >> Roman Kennke has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Remove unnecessary import > > src/java.base/share/classes/java/io/ClassCache.java line 63: > >> 61: protect

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v7]

2021-12-06 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v6]

2021-12-04 Thread Peter Levart
On Thu, 2 Dec 2021 16:22:02 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v4]

2021-12-04 Thread Peter Levart
On Thu, 2 Dec 2021 14:24:06 GMT, Roman Kennke wrote: >> src/java.base/share/classes/java/io/ObjectStreamClass.java line 2133: >> >>> 2131: if (oldReflector != null) { >>> 2132: reflector = oldReflector; >>> 2133: } >> >> Map.computeIfAbsent(key, () -> new

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v5]

2021-12-02 Thread Roman Kennke
On Thu, 2 Dec 2021 16:14:18 GMT, Roger Riggs wrote: >> Roman Kennke has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Implement ClassCache: reclaim entries under memory pressure > > ObjectStreamClass may have an unnecesary import of `SoftR

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v6]

2021-12-02 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v5]

2021-12-02 Thread Roger Riggs
On Thu, 2 Dec 2021 14:30:07 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v4]

2021-12-02 Thread Roman Kennke
On Wed, 1 Dec 2021 21:09:14 GMT, Roger Riggs wrote: > Without the use of SoftReference, memory pressure won't release any of the > cached info. That seems to swing the other way from overly aggressively > freeing memory with the WeakReference (and needing to recompute) as the > change original

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v5]

2021-12-02 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v4]

2021-12-01 Thread Roger Riggs
On Wed, 1 Dec 2021 12:18:05 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get recl

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v3]

2021-12-01 Thread Roman Kennke
On Wed, 1 Dec 2021 10:49:54 GMT, Peter Levart wrote: > ...I think that you could remove now obsolete > java.io.ObjectStreamClass.EntryFuture nested class. It's not used any more. Done. > It would be nice to follow-up this patch with patches that make use of > ClassValue also for: > > * j

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v4]

2021-12-01 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v3]

2021-12-01 Thread Peter Levart
On Tue, 30 Nov 2021 11:25:48 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get rec

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v3]

2021-11-30 Thread Peter Levart
On Tue, 30 Nov 2021 11:25:48 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get rec

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-30 Thread Roman Kennke
On Mon, 15 Nov 2021 21:35:06 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get rec

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v3]

2021-11-30 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-29 Thread Peter Levart
On Mon, 15 Nov 2021 21:35:06 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get rec

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-29 Thread Peter Levart
On Mon, 29 Nov 2021 13:47:19 GMT, Roman Kennke wrote: > I don't quite understand this: If the Class object is still reachable by the > app, 1. a weak reference would not get cleared and 2. the Class's ClassLoader would not get unloaded. ...but the ObjectStreamClass instance could still get GC-

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-29 Thread Roman Kennke
On Mon, 15 Nov 2021 21:35:06 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get rec

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2021-11-29 Thread Peter Levart
On Mon, 15 Nov 2021 19:10:17 GMT, Roman Kennke wrote: > > If the intent of this change is to alter the lifetimes of the objects in > > question in a meaningful way, I recommend a CSR for the behavioral > > compatibility impact. > > It would be hard for application code to observe this change:

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-29 Thread Roman Kennke
On Mon, 15 Nov 2021 21:35:06 GMT, Roman Kennke wrote: >> The caches in ObjectStreamClass basically map WeakReference to >> SoftReference, where the ObjectStreamClass also >> references the same Class. That means that the cache entry, and thus the >> class and its class-loader, will not get rec

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-15 Thread Roman Kennke
On Mon, 15 Nov 2021 19:30:54 GMT, Roger Riggs wrote: >> Roman Kennke has updated the pull request incrementally with two additional >> commits since the last revision: >> >> - Use ForceGC instead of System.gc() >> - Convert test to testng > > test/jdk/java/io/ObjectStreamClass/TestOSCClassLoa

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive [v2]

2021-11-15 Thread Roman Kennke
> The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaimed, unless the GC determines that memory > pressure is

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2021-11-15 Thread Roger Riggs
On Fri, 12 Nov 2021 21:43:42 GMT, Roman Kennke wrote: > The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaim

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2021-11-15 Thread Roman Kennke
On Mon, 15 Nov 2021 18:01:04 GMT, Joe Darcy wrote: > If the intent of this change is to alter the lifetimes of the objects in > question in a meaningful way, I recommend a CSR for the behavioral > compatibility impact. It would be hard for application code to observe this change: before the c

Re: RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2021-11-15 Thread Joe Darcy
On Fri, 12 Nov 2021 21:43:42 GMT, Roman Kennke wrote: > The caches in ObjectStreamClass basically map WeakReference to > SoftReference, where the ObjectStreamClass also references > the same Class. That means that the cache entry, and thus the class and its > class-loader, will not get reclaim

RFR: 8277072: ObjectStreamClass caches keep ClassLoaders alive

2021-11-15 Thread Roman Kennke
The caches in ObjectStreamClass basically map WeakReference to SoftReference, where the ObjectStreamClass also references the same Class. That means that the cache entry, and thus the class and its class-loader, will not get reclaimed, unless the GC determines that memory pressure is very high.