Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-34496

Classloading deadlock between ExecNodeMetadataUtil and JsonSerdeUtil

    XMLWordPrintableJSON

Details

    Description

      This is a fun one!

      ExecNodeMetadataUtil and JsonSerdeUtil have a circular dependency in their static initialization, which can cause a classloading lockup when 2 threads are running the class initialization of each class at the same time because during class initialization they hold a lock.

      https://ternarysearch.blogspot.com/2013/07/static-initialization-deadlock.html

      JsonSerdeUtils#createFlinkTableJacksonModule calls into the ExecNodeMetadataUtil, while ExecNodeMetadataUtil#addToLookupMap calls into the JsonSerdeUtils.

       "ForkJoinPool-3-worker-11" #25 daemon prio=5 os_prio=0 cpu=219.87ms elapsed=995.99s tid=0x00007ff11c50e000 nid=0xf0fc in Object.wait()  [0x00007ff12a4f3000]
          java.lang.Thread.State: RUNNABLE
       	at o.a.f.t.p.plan.nodes.exec.serde.JsonSerdeUtil.createFlinkTableJacksonModule(JsonSerdeUtil.java:133)
       	at o.a.f.t.p.plan.nodes.exec.serde.JsonSerdeUtil.<clinit>(JsonSerdeUtil.java:111)
      
      "ForkJoinPool-3-worker-7" #23 daemon prio=5 os_prio=0 cpu=54.83ms elapsed=996.00s tid=0x00007ff11c50c000 nid=0xf0fb in Object.wait()  [0x00007ff12a5f4000]
         java.lang.Thread.State: RUNNABLE
      	at o.a.f.t.p.plan.utils.ExecNodeMetadataUtil.addToLookupMap(ExecNodeMetadataUtil.java:235)
      	at o.a.f.t.p.plan.utils.ExecNodeMetadataUtil.<clinit>(ExecNodeMetadataUtil.java:156)
      

      Attachments

        Issue Links

          Activity

            People

              chesnay Chesnay Schepler
              chesnay Chesnay Schepler
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: