RFR: 8277444: Race condition on Instrumentation.retransformClasses() and class linking [v3]

Evgeny Astigeevich eastigeevich at openjdk.org
Wed Aug 27 13:54:46 UTC 2025


On Wed, 27 Aug 2025 13:23:58 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> I think both should link the class first. It's because I don't like the init-lock exposed this way, and I'm concerned with JVMTI getting and saving unverified bytecodes.

In logs I see we do class verification:


[0.962s][debug][class,link              ] JvmtiEnv::RetransformClasses
[0.970s][debug][redefine,class,load     ] loading name=BigClass kind=101 (avail_mem=252818288K)
[0.970s][debug][class,preorder          ] BigClass source: __VM_RedefineClasses__
[0.971s][debug][class,load,placeholders ] entry BigClass : find_and_add DETECT_CIRCULARITY , next_klass_name 'java/lang/Object'
[0.971s][debug][class,load,placeholders ] loadInstanceThreadQ threads:
[0.971s][debug][class,load,placeholders ] circularityThreadQ threads:0x0000ffff903953b0,
[0.971s][debug][class,load,placeholders ] defineThreadQ threads:
[0.971s][debug][class,load,placeholders ] entry BigClass : find_and_remove DETECT_CIRCULARITY , next_klass_name 'java/lang/Object'
[0.971s][debug][class,load,placeholders ] loadInstanceThreadQ threads:
[0.971s][debug][class,load,placeholders ] circularityThreadQ threads:0x0000ffff903953b0,
[0.971s][debug][class,load,placeholders ] defineThreadQ threads:
[0.971s][debug][class,load              ] set_secondary_supers: hash_slot: 45; klass: BigClass
[0.971s][debug][class,load              ]   - 0 elements; bitmap: 0x0000000000000000
[0.973s][info ][class,load              ] BigClass source: __VM_RedefineClasses__
[0.973s][debug][class,load              ]  klass: 0x000000001a088000 super: 0x000000001a001200 loader: [loader data: 0x0000ffff903fc510 for instance a 'Main$AsmClassLoader'{0x00000000ff1a3d28}] bytes: 1403966 checksum: 4f2e199f
[0.973s][debug][class,resolve           ] BigClass java.lang.Object (super)
[0.973s][debug][class,link              ] VM_RedefineClasses::load_new_class_versions 0x000000001a086800
[0.973s][info ][class,init              ] Start class verification for: BigClass
[1.005s][info ][class,init              ] End class verification for: BigClass
[1.005s][debug][class,link              ] rewrite_class 0x000000001a086800
[1.016s][debug][class,link              ] done rewrite_class 0x000000001a086800
[1.016s][info ][class,init              ] Start class verification for: BigClass
[1.048s][info ][class,init              ] End class verification for: BigClass
[1.048s][info ][redefine,class,constantpool] old_cp_len=116, scratch_cp_len=116
[1.048s][debug][redefine,class,constantpool] after pass 0: merge_cp_len=116
[1.048s][debug][redefine,class,constantpool] after pass 1a: merge_cp_len=116, scratch_i=116, index_map_len=0
[1.048s][info ][redefine,class,constantpool] merge_cp_len=116, index_map_len=0
[1.048s][debug][class,loader,data          ] deallocate added for constant pool [232] {0x0000ffff30947748}
[1.059s][debug][redefine,class,load        ] loaded name=BigClass (avail_mem=252817012K)
[1.079s][debug][class,loader,data          ] deallocate added for 'BigClass'
[1.079s][info ][redefine,class,load        ] redefined name=BigClass, count=1 (avail_mem=252817012K)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26863#issuecomment-3228303222


More information about the hotspot-dev mailing list