Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-4698

`-target:jvm-1.7` in scalaCompileOptions seems to cause java.lang.VerifyError when loading kafka/client/ClientUtils

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.1.1
    • 0.10.2.0
    • None
    • None

    Description

      When we updated to kafka 2.11-0.10.1.1 from 2.11-0.8.2.2 we started getting the following error

      java.lang.VerifyError: Stack map does not match the one at exception handler 190
      Exception Details:
        Location:
          kafka/client/ClientUtils$.fetchTopicMetadata(Lscala/collection/Set;Lscala/collection/Seq;Lkafka/producer/ProducerConfig;I)Lkafka/api/TopicMetadataResponse; @190: astore
        Reason:
          Type top (current frame, locals[12]) is not assignable to 'kafka/producer/SyncProducer' (stack map, locals[12])
        Current Frame:
          bci: @63
          flags: { }
          locals: { 'kafka/client/ClientUtils$', 'scala/collection/Set', 'scala/collection/Seq', 'kafka/producer/ProducerConfig', integer, integer, 'scala/runtime/IntRef', 'kafka/api/TopicMetadataRequest', 'kafka/api/TopicMetadataResponse', 'java/lang/Throwable', 'scala/collection/Seq', 'kafka/producer/SyncProducer' }
          stack: { 'java/lang/Throwable' }
        Stackmap Frame:
          bci: @190
          flags: { }
          locals: { 'kafka/client/ClientUtils$', 'scala/collection/Set', 'scala/collection/Seq', 'kafka/producer/ProducerConfig', integer, integer, 'scala/runtime/IntRef', 'kafka/api/TopicMetadataRequest', 'kafka/api/TopicMetadataResponse', 'java/lang/Throwable', 'scala/collection/Seq', top, 'kafka/producer/SyncProducer' }
          stack: { 'java/lang/Throwable' }
        Bytecode:
          0x0000000: 0336 0503 b800 aa3a 06bb 00ac 59b2 00b1
          0x0000010: b600 b515 042d b600 ba2b b900 c001 00b7
          0x0000020: 00c3 3a07 013a 0801 3a09 b200 c82c b200
          0x0000030: cdb6 00d1 b600 d5c0 00d7 3a0a a700 353a
          0x0000040: 0b2a bb00 0b59 2b15 0419 0619 0ab7 00de
          0x0000050: bb00 0d59 190b b700 e1b6 00e3 190b 3a09
          0x0000060: 1906 1906 b400 e704 60b5 00e7 190c b600
          0x0000070: ea19 06b4 00e7 190a b900 ee01 00a2 0057
          0x0000080: 1505 9a00 52b2 00f3 2d19 0a19 06b4 00e7
          0x0000090: b900 f702 00c0 00f9 b600 fd3a 0c2a bb00
          0x00000a0: 0f59 2b15 0419 0619 0ab7 00fe b601 0019
          0x00000b0: 0c19 07b6 0104 3a08 0436 05a7 ffa5 3a0d
          0x00000c0: 1906 1906 b400 e704 60b5 00e7 190c b600
          0x00000d0: ea19 0dbf 1505 9900 122a bb00 1159 2bb7
          0x00000e0: 0107 b601 0919 08b0 bb01 0b59 bb01 0d59
          0x00000f0: b201 1213 0114 b601 18b7 011a b201 1205
          0x0000100: bd00 0459 032b 5359 0419 0a53 b601 1eb6
          0x0000110: 0122 1909 b701 25bf                    
        Exception Handler Table:
          bci [175, 190] => handler: 63
          bci [175, 190] => handler: 190
          bci [63, 96] => handler: 190
        Stackmap Table:
          full_frame(@63,{Object[#2],Object[#188],Object[#215],Object[#183],Integer,Integer,Object[#166],Object[#172],Object[#217],Object[#72],Object[#215],Object[#219]},{Object[#72]})
          full_frame(@96,{Object[#2],Object[#188],Object[#215],Object[#183],Integer,Integer,Object[#166],Object[#172],Object[#217],Object[#72],Object[#215],Top,Object[#219]},{})
          chop_frame(@113,2)
          full_frame(@190,{Object[#2],Object[#188],Object[#215],Object[#183],Integer,Integer,Object[#166],Object[#172],Object[#217],Object[#72],Object[#215],Top,Object[#219]},{Object[#72]})
          chop_frame(@212,2)
          same_frame(@232)
       
      	at kafka.consumer.ConsumerFetcherManager$LeaderFinderThread.doWork(ConsumerFetcherManager.scala:65)
      	at kafka.utils.ShutdownableThread.run(ShutdownableThread.scala:63)
      

      Which looks like it's coming from the change in https://issues.apache.org/jira/browse/KAFKA-3375. The suggested fix was to rebuild the 0.10.1.1 jar without

      "-target:jvm-${sourceCompatibility}".toString(),
      

      in the `scalaCompileOptions.additionalParameters`.

      Once we made this change and rebuilt the jar the VerifyError stopped happening.

      The complete diff of the change we used is

      diff --git a/build.gradle b/build.gradle
      index fded48e05..857144d62 100644
      --- a/build.gradle
      +++ b/build.gradle
      @@ -250,7 +250,6 @@ subprojects {
             "-deprecation",
             "-unchecked",
             "-encoding", "utf8",
      -      "-target:jvm-${sourceCompatibility}".toString(),
             "-Xlog-reflective-calls",
             "-feature",
             "-language:postfixOps",
      

      cc: ijuma sriharsha

      Attachments

        Issue Links

          Activity

            People

              ijuma Ismael Juma
              cheister Chris Heisterkamp
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: