1

我需要聚合一些传感器数据,并且我正在为 PoC/研究项目尝试窗口聚合。

在到处研究并进行了很多尝试之后,我想出了以下代码,这似乎可以正常工作。事实上,我得到了显示预期结果的窥视,我还可以看到 SensorData 对象的反序列化/序列化通过流发生。

我可以在输出主题中看到最终结果。

但问题是:在输出主题中写入第一个结果后,流会崩溃,并且它会根据 commitMs 的长度提前或延迟崩溃。

任何想法?我在这里做错了吗?我正在使用landoop/fast-data-dev docker 镜像来测试它。

    long commitMs = TBD;
    Properties config = new Properties();

    config.put(StreamsConfig.APPLICATION_ID_CONFIG, "sensor-data-stream-analyzer");
    config.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "kafka-cluster1:9092");
    config.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
    config.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
    config.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());
    config.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, commitMs);
    config.put(StreamsConfig.DEFAULT_TIMESTAMP_EXTRACTOR_CLASS_CONFIG, WallclockTimestampExtractor.class);

    final Serializer<SensorReport> jsonSerializer = new MyJsonSerializer();
    final Deserializer<SensorReport> jsonDeserializer = new MyJsonDeserializer(SensorReport.class);
    final Serde<SensorReport> jsonSerde = Serdes.serdeFrom(jsonSerializer, jsonDeserializer);
    final Serde<String> stringSerde = Serdes.String();
    final Serde<Long> longSerde = Serdes.Long();

    StreamsBuilder builder = new StreamsBuilder();

    KStream<String, SensorReport> stream =
            builder.stream(inputTopic, Consumed.with(stringSerde, jsonSerde));

    stream
    .peek((k,v)-> System.out.println("1|k: " + k + "v: " + v.toString()))
    .map((key, sensorReport) -> {
        double[] fakeLatLon = new double[]{10,10};
        return KeyValue.pair(String.format("%f %f", fakeLatLon[0], fakeLatLon[1]), sensorReport);
    })
    .peek((k,v)-> System.out.println("2|k: " + k + "v: " + v.toString()))
    .groupByKey(Serialized.with(stringSerde, jsonSerde))
    .windowedBy(TimeWindows.of(10000L).until(10000L))
    .count()
    .toStream((k, v) -> String.format("%d %s", k.window().start(), k.key()))
    .peek((k,v)-> System.out.println("3|k: " + k + "v: " + v.toString()))
    .map((k,v) -> KeyValue.pair(k, v.toString()))
    .to(outputTopic, Produced.with(stringSerde, stringSerde));

    KafkaStreams run = new KafkaStreams(builder.build(), getConfig());

    run.start();

这是堆栈跟踪的相关部分:

Stack: [0x00007faacee5f000,0x00007faacef5fad0],  sp=0x00007faacef5b3b8,  free space=1008k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x0000000000149aa6
C  [librocksdbjni6827723631295059350.so+0x3dc5b8]
C  [librocksdbjni6827723631295059350.so+0x3e13b5]  rocksdb::ParseColumnFamilyOption(std::string const&, std::string const&, rocksdb::ColumnFamilyOptions*, bool)+0xc95
C  [librocksdbjni6827723631295059350.so+0x3e2282]  rocksdb::GetColumnFamilyOptionsFromMapInternal(rocksdb::ColumnFamilyOptions const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, rocksdb::ColumnFamilyOptions*, bool, std::vector<std::string, std::allocator<std::string> >*, bool)+0x582
C  [librocksdbjni6827723631295059350.so+0x3e2480]  rocksdb::GetColumnFamilyOptionsFromMap(rocksdb::ColumnFamilyOptions const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, rocksdb::ColumnFamilyOptions*, bool, bool)+0x20
C  [librocksdbjni6827723631295059350.so+0x3e8d5e]  rocksdb::RocksDBOptionsParser::EndSection(rocksdb::OptionSection, std::string const&, std::string const&, std::unordered_map<std::string, std::string, std::hash<std::string>, std::equal_to<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, bool)+0x5ee
C  [librocksdbjni6827723631295059350.so+0x3e97ac]  rocksdb::RocksDBOptionsParser::Parse(std::string const&, rocksdb::Env*, bool)+0x5fc
C  [librocksdbjni6827723631295059350.so+0x3ea8df]  rocksdb::RocksDBOptionsParser::VerifyRocksDBOptionsFromFile(rocksdb::DBOptions const&, std::vector<std::string, std::allocator<std::string> > const&, std::vector<rocksdb::ColumnFamilyOptions, std::allocator<rocksdb::ColumnFamilyOptions> > const&, std::string const&, rocksdb::Env*, rocksdb::OptionsSanityCheckLevel, bool)+0x7f
C  [librocksdbjni6827723631295059350.so+0x3ec7a3]  rocksdb::PersistRocksDBOptions(rocksdb::DBOptions const&, std::vector<std::string, std::allocator<std::string> > const&, std::vector<rocksdb::ColumnFamilyOptions, std::allocator<rocksdb::ColumnFamilyOptions> > const&, std::string const&, rocksdb::Env*)+0x1013
C  [librocksdbjni6827723631295059350.so+0x2e8540]  rocksdb::DBImpl::WriteOptionsFile(bool, bool)+0x960
C  [librocksdbjni6827723631295059350.so+0x315e68]  rocksdb::DB::Open(rocksdb::DBOptions const&, std::string const&, std::vector<rocksdb::ColumnFamilyDescriptor, std::allocator<rocksdb::ColumnFamilyDescriptor> > const&, std::vector<rocksdb::ColumnFamilyHandle*, std::allocator<rocksdb::ColumnFamilyHandle*> >*, rocksdb::DB**)+0x16c8
C  [librocksdbjni6827723631295059350.so+0x316937]  rocksdb::DB::Open(rocksdb::Options const&, std::string const&, rocksdb::DB**)+0x177
C  [librocksdbjni6827723631295059350.so+0x28240a]  std::_Function_handler<rocksdb::Status (rocksdb::Options const&, std::string const&, rocksdb::DB**), rocksdb::Status (*)(rocksdb::Options const&, std::string const&, rocksdb::DB**)>::_M_invoke(std::_Any_data const&, rocksdb::Options const&, std::string const&, rocksdb::DB**)+0x1a
C  [librocksdbjni6827723631295059350.so+0x27b2ae]  rocksdb_open_helper(JNIEnv_*, long, _jstring*, std::function<rocksdb::Status (rocksdb::Options const&, std::string const&, rocksdb::DB**)>)+0x7e
C  [librocksdbjni6827723631295059350.so+0x27b3ee]  Java_org_rocksdb_RocksDB_open__JLjava_lang_String_2+0x3e
j  org.rocksdb.RocksDB.open(JLjava/lang/String;)J+0
j  org.rocksdb.RocksDB.open(Lorg/rocksdb/Options;Ljava/lang/String;)Lorg/rocksdb/RocksDB;+9
j  org.apache.kafka.streams.state.internals.RocksDBStore.openDB(Ljava/io/File;Lorg/rocksdb/Options;I)Lorg/rocksdb/RocksDB;+25
j  org.apache.kafka.streams.state.internals.RocksDBStore.openDB(Lorg/apache/kafka/streams/processor/ProcessorContext;)V+282
j  org.apache.kafka.streams.state.internals.Segment.openDB(Lorg/apache/kafka/streams/processor/ProcessorContext;)V+2
j  org.apache.kafka.streams.state.internals.Segments.getOrCreateSegment(JLorg/apache/kafka/streams/processor/ProcessorContext;)Lorg/apache/kafka/streams/state/internals/Segment;+102
j  org.apache.kafka.streams.state.internals.RocksDBSegmentedBytesStore.put(Lorg/apache/kafka/common/utils/Bytes;[B)V+27
j  org.apache.kafka.streams.state.internals.RocksDBWindowStore.put(Ljava/lang/Object;Ljava/lang/Object;J)V+29
j  org.apache.kafka.streams.state.internals.ChangeLoggingWindowBytesStore.put(Lorg/apache/kafka/common/utils/Bytes;[BJ)V+7
j  org.apache.kafka.streams.state.internals.ChangeLoggingWindowBytesStore.put(Ljava/lang/Object;Ljava/lang/Object;J)V+10
j  org.apache.kafka.streams.state.internals.CachingWindowStore$1.apply(Ljava/util/List;)V+117
j  org.apache.kafka.streams.state.internals.NamedCache.flush(Lorg/apache/kafka/streams/state/internals/NamedCache$LRUNode;)V+356
j  org.apache.kafka.streams.state.internals.NamedCache.flush()V+2
j  org.apache.kafka.streams.state.internals.ThreadCache.flush(Ljava/lang/String;)V+22
j  org.apache.kafka.streams.state.internals.CachingWindowStore.flush()V+8
j  org.apache.kafka.streams.state.internals.MeteredWindowStore.flush()V+14
j  org.apache.kafka.streams.processor.internals.ProcessorStateManager.flush()V+77
j  org.apache.kafka.streams.processor.internals.AbstractTask.flushState()V+4
j  org.apache.kafka.streams.processor.internals.StreamTask.flushState()V+12
j  org.apache.kafka.streams.processor.internals.StreamTask.commit(Z)V+22
j  org.apache.kafka.streams.processor.internals.StreamTask.commit()V+2
j  org.apache.kafka.streams.processor.internals.AssignedTasks$1.apply(Lorg/apache/kafka/streams/processor/internals/Task;)V+1
j  org.apache.kafka.streams.processor.internals.AssignedTasks.applyToRunningTasks(Lorg/apache/kafka/streams/processor/internals/TaskAction;)V+35
j  org.apache.kafka.streams.processor.internals.AssignedTasks.commit()I+5
j  org.apache.kafka.streams.processor.internals.TaskManager.commitAll()I+4
j  org.apache.kafka.streams.processor.internals.StreamThread.maybeCommit(J)V+96
j  org.apache.kafka.streams.processor.internals.StreamThread.runOnce(J)J+280
j  org.apache.kafka.streams.processor.internals.StreamThread.runLoop()V+33
j  org.apache.kafka.streams.processor.internals.StreamThread.run()V+36
v  ~StubRoutines::call_stub
V  [libjvm.so+0x41ab0a]
C  0x0000560ba0323140

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x0000560ba02c2000 JavaThread "kafka-coordinator-heartbeat-thread | sensor-data-stream-analyzer" daemon [_thread_blocked, id=2505, stack(0x00007faacec5d000,0x00007faaced5dad0)]
  0x0000560ba027b800 JavaThread "DestroyJavaVM" [_thread_blocked, id=2487, stack(0x00007faae7a89000,0x00007faae7b89ad0)]
  0x0000560ba0325000 JavaThread "sensor-data-stream-analyzer-150fc5f9-aed6-4774-9520-a0599d8566a1-CleanupThread" daemon [_thread_blocked, id=2504, stack(0x00007faaced5e000,0x00007faacee5ead0)]
=>0x0000560ba0322000 JavaThread "sensor-data-stream-analyzer-150fc5f9-aed6-4774-9520-a0599d8566a1-StreamThread-1" [_thread_in_native, id=2503, stack(0x00007faacee5f000,0x00007faacef5fad0)]
  0x0000560ba02a6800 JavaThread "kafka-producer-network-thread | sensor-data-stream-analyzer-150fc5f9-aed6-4774-9520-a0599d8566a1-StreamThread-1-producer" daemon [_thread_in_native, id=2502, stack(0x00007faacef60000,0x00007faacf060ad0)]
  0x0000560ba0191800 JavaThread "kafka-admin-client-thread | sensor-data-stream-analyzer-150fc5f9-aed6-4774-9520-a0599d8566a1-admin" daemon [_thread_in_native, id=2501, stack(0x00007faacf261000,0x00007faacf361ad0)]
  0x0000560b9fb20800 JavaThread "Service Thread" daemon [_thread_blocked, id=2499, stack(0x00007faad29ed000,0x00007faad2aedad0)]
  0x0000560b9faef800 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=2498, stack(0x00007faad2aef000,0x00007faad2befad0)]
  0x0000560b9faa1000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=2497, stack(0x00007faad2bf1000,0x00007faad2cf1ad0)]
  0x0000560b9fa94000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=2496, stack(0x00007faad2cf3000,0x00007faad2df3ad0)]
  0x0000560b9fa91800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=2495, stack(0x00007faad2df4000,0x00007faad2ef4ad0)]
  0x0000560b9fa64800 JavaThread "Finalizer" daemon [_thread_blocked, id=2494, stack(0x00007faad2ef5000,0x00007faad2ff5ad0)]
  0x0000560b9fa5a000 JavaThread "Reference Handler" daemon [_thread_blocked, id=2493, stack(0x00007faad2ff6000,0x00007faad30f6ad0)]

Internal exceptions (10 events):
Event: 1.360 Thread 0x0000560b9f909000 Exception <a 'java/lang/ArrayIndexOutOfBoundsException'> (0x00000000e2109468) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/runtime/sharedRuntime.cpp, line 613]
Event: 1.715 Thread 0x0000560ba0191800 Exception <a 'java/lang/NoSuchMethodError': java.lang.Object.lambda$identity$2(Ljava/lang/Object;)Ljava/lang/Object;> (0x00000000e1213bd0) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/interpreter/lin
Event: 1.949 Thread 0x0000560ba0322000 Implicit null exception at 0x00007faad8cd8235 to 0x00007faad8cd85dd
Event: 3.059 Thread 0x0000560ba0322000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e1c1e250) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]
Event: 3.074 Thread 0x0000560ba0322000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e1c7b6e8) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]
Event: 3.076 Thread 0x0000560ba0322000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e1c854a8) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]
Event: 3.077 Thread 0x0000560ba0322000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e1c8e7e8) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]
Event: 3.079 Thread 0x0000560ba0322000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e1c98678) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]
Event: 3.080 Thread 0x0000560ba0322000 Exception <a 'java/io/FileNotFoundException'> (0x00000000e1ca2470) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]
Event: 12.177 Thread 0x0000560ba0322000 Exception <a 'sun/nio/fs/UnixException'> (0x00000000e145de70) thrown at [/home/buildozer/aports/community/openjdk8/src/icedtea-3.11.0/openjdk/hotspot/src/share/vm/prims/jni.cpp, line 709]

Dynamic libraries:

560b9f7b0000-560b9f7b1000 r--p 00000000 08:01 1189695                    /usr/lib/jvm/java-1.8-openjdk/jre/bin/java
560b9f7b1000-560b9f7b2000 r-xp 00001000 08:01 1189695                    /usr/lib/jvm/java-1.8-openjdk/jre/bin/java
560b9f7b2000-560b9f7b3000 r--p 00002000 08:01 1189695                    /usr/lib/jvm/java-1.8-openjdk/jre/bin/java
560b9f7b3000-560b9f7b4000 r--p 00002000 08:01 1189695                    /usr/lib/jvm/java-1.8-openjdk/jre/bin/java
560b9f7b4000-560b9f7b5000 rw-p 00003000 08:01 1189695                    /usr/lib/jvm/java-1.8-openjdk/jre/bin/java

7faacdfd0000-7faace1f4000 r-xp 00000000 08:01 1317566                    /usr/glibc-compat/lib/ld-2.27.so
7faace1f4000-7faace1f5000 r--p 00024000 08:01 1317566                    /usr/glibc-compat/lib/ld-2.27.so
7faace1f5000-7faace1f6000 rw-p 00025000 08:01 1317566                    /usr/glibc-compat/lib/ld-2.27.so

7faace1f7000-7faacea32000 r-xp 00000000 08:01 1320848                    /tmp/librocksdbjni6827723631295059350.so
7faacea32000-7faacea50000 rw-p 0063b000 08:01 1320848                    /tmp/librocksdbjni6827723631295059350.so

7faacf562000-7faacf569000 r--p 00000000 08:01 1311101                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnio.so
7faacf569000-7faacf571000 r-xp 00007000 08:01 1311101                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnio.so
7faacf571000-7faacf575000 r--p 0000f000 08:01 1311101                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnio.so
7faacf575000-7faacf576000 r--p 00012000 08:01 1311101                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnio.so
7faacf576000-7faacf577000 rw-p 00013000 08:01 1311101                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnio.so

7faad2578000-7faad257c000 r--p 00000000 08:01 1311100                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnet.so
7faad257c000-7faad258b000 r-xp 00004000 08:01 1311100                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnet.so
7faad258b000-7faad2590000 r--p 00013000 08:01 1311100                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnet.so
7faad2590000-7faad2591000 r--p 00017000 08:01 1311100                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnet.so
7faad2591000-7faad2592000 rw-p 00018000 08:01 1311100                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libnet.so
7faad2592000-7faad2596000 r--p 00000000 08:01 1311098                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libmanagement.so
7faad2596000-7faad2599000 r-xp 00004000 08:01 1311098                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libmanagement.so
7faad2599000-7faad259b000 r--p 00007000 08:01 1311098                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libmanagement.so
7faad259b000-7faad259c000 r--p 00008000 08:01 1311098                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libmanagement.so
7faad259c000-7faad259d000 rw-p 00009000 08:01 1311098                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libmanagement.so
7faad259d000-7faad25a1000 r--s 00058000 08:01 1189715                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/jsse.jar

7faad27a1000-7faad28eb000 r--s 01cb4000 00:51 8654897590                 /kafka-dev/sensor-stream-analyzer-1.0-jar-with-dependencies.jar

7faad4156000-7faad4325000 r--s 01f54000 08:01 1189724                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/rt.jar

7faae7a30000-7faae7a33000 r--p 00000000 08:01 1311106                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libzip.so
7faae7a33000-7faae7a37000 r-xp 00003000 08:01 1311106                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libzip.so
7faae7a37000-7faae7a39000 r--p 00007000 08:01 1311106                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libzip.so
7faae7a39000-7faae7a3a000 r--p 00008000 08:01 1311106                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libzip.so
7faae7a3a000-7faae7a3b000 rw-p 00009000 08:01 1311106                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libzip.so
7faae7a3b000-7faae7a43000 rw-s 00000000 08:01 1320843                    /tmp/hsperfdata_root/2486

7faae7a45000-7faae7a52000 r--p 00000000 08:01 1311090                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libjava.so
7faae7a52000-7faae7a6a000 r-xp 0000d000 08:01 1311090                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libjava.so
7faae7a6a000-7faae7a72000 r--p 00025000 08:01 1311090                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libjava.so
7faae7a72000-7faae7a73000 r--p 0002c000 08:01 1311090                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libjava.so
7faae7a73000-7faae7a74000 rw-p 0002d000 08:01 1311090                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libjava.so

7faae7a75000-7faae7a7a000 r--p 00000000 08:01 1311105                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libverify.so
7faae7a7a000-7faae7a81000 r-xp 00005000 08:01 1311105                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libverify.so
7faae7a81000-7faae7a84000 r--p 0000c000 08:01 1311105                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libverify.so
7faae7a84000-7faae7a86000 r--p 0000e000 08:01 1311105                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libverify.so
7faae7a86000-7faae7a87000 rw-p 00010000 08:01 1311105                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/libverify.so

7faae7b8a000-7faae7b8d000 r--p 00000000 08:01 1189738                    /usr/lib/libgcc_s.so.1
7faae7b8d000-7faae7b99000 r-xp 00003000 08:01 1189738                    /usr/lib/libgcc_s.so.1
7faae7b99000-7faae7b9c000 r--p 0000f000 08:01 1189738                    /usr/lib/libgcc_s.so.1
7faae7b9c000-7faae7b9d000 r--p 00011000 08:01 1189738                    /usr/lib/libgcc_s.so.1
7faae7b9d000-7faae7b9e000 rw-p 00012000 08:01 1189738                    /usr/lib/libgcc_s.so.1
7faae7b9e000-7faae7c3a000 r--p 00000000 08:01 1189800                    /usr/lib/libstdc++.so.6.0.25
7faae7c3a000-7faae7ca8000 r-xp 0009c000 08:01 1189800                    /usr/lib/libstdc++.so.6.0.25
7faae7ca8000-7faae7ce1000 r--p 0010a000 08:01 1189800                    /usr/lib/libstdc++.so.6.0.25
7faae7ce1000-7faae7cef000 r--p 00142000 08:01 1189800                    /usr/lib/libstdc++.so.6.0.25
7faae7cef000-7faae7cf0000 rw-p 00150000 08:01 1189800                    /usr/lib/libstdc++.so.6.0.25

7faae7cf3000-7faae7ee7000 r--p 00000000 08:01 1311110                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server/libjvm.so
7faae7ee7000-7faae82f4000 r-xp 001f4000 08:01 1311110                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server/libjvm.so
7faae82f4000-7faae84b9000 r--p 00601000 08:01 1311110                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server/libjvm.so
7faae84b9000-7faae854f000 r--p 007c5000 08:01 1311110                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server/libjvm.so
7faae854f000-7faae8577000 rw-p 0085b000 08:01 1311110                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/server/libjvm.so

7faae85a8000-7faae85ab000 r--p 00000000 08:01 1310764                    /lib/libz.so.1.2.11
7faae85ab000-7faae85b9000 r-xp 00003000 08:01 1310764                    /lib/libz.so.1.2.11
7faae85b9000-7faae85c0000 r--p 00011000 08:01 1310764                    /lib/libz.so.1.2.11
7faae85c0000-7faae85c1000 r--p 00017000 08:01 1310764                    /lib/libz.so.1.2.11
7faae85c1000-7faae85c2000 rw-p 00018000 08:01 1310764                    /lib/libz.so.1.2.11
7faae85c2000-7faae85c4000 r--p 00000000 08:01 1311076                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/jli/libjli.so
7faae85c4000-7faae85cd000 r-xp 00002000 08:01 1311076                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/jli/libjli.so
7faae85cd000-7faae85d1000 r--p 0000b000 08:01 1311076                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/jli/libjli.so
7faae85d1000-7faae85d2000 r--p 0000e000 08:01 1311076                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/jli/libjli.so
7faae85d2000-7faae85d3000 rw-p 0000f000 08:01 1311076                    /usr/lib/jvm/java-1.8-openjdk/jre/lib/amd64/jli/libjli.so
7faae85d3000-7faae85ea000 r--p 00000000 08:01 1320878                    /lib/ld-musl-x86_64.so.1
7faae85ea000-7faae862f000 r-xp 00017000 08:01 1320878                    /lib/ld-musl-x86_64.so.1
7faae862f000-7faae8661000 r--p 0005c000 08:01 1320878                    /lib/ld-musl-x86_64.so.1
7faae8661000-7faae8662000 r--p 0008d000 08:01 1320878                    /lib/ld-musl-x86_64.so.1
7faae8662000-7faae8663000 rw-p 0008e000 08:01 1320878                    /lib/ld-musl-x86_64.so.1

---------------  S Y S T E M  ---------------

OS:NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.9.2
PRETTY_NAME="Alpine Linux v3.9"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
4

1 回答 1

2

我解决了我的问题,我将在这里分享我的解决方案,供遇到同样问题的人使用。

最初,堆栈跟踪行"C [librocksdbjni6827723631295059350.so+0x3e13b5] rocksdb::ParseColumnFamilyOption(std::string const&, std::string const&, rocksdb::ColumnFamilyOptions*, bool)+0xc95"让我认为这是一个 musl-libc 与 glibc 相关的问题,如以下两个问题链接中所述:

事实上,我使用的是基于 Alpine 的landoop/fast-data-dev:latest docker 镜像。但是快速浏览一下landoop/fast-data-dev,可以看出作者处理的是glibc:

https://github.com/Landoop/fast-data-dev/blob/master/Dockerfile

# glibc    : alpine linux has an embedded libc which misses some functions that are
#            needed by some apps (e.g jvm's rocksdb jni — HDFS connector, Lenses, etc),
#            so we add glibc to make them work. Also now we can add en_US.UTF-8 locale.
#            https://github.com/sgerrand/alpine-pkg-glibc

通过简单地替换我的 pom.xml 中的 kafka-stream 依赖项,崩溃就消失了

<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-streams</artifactId>
    <version>2.0.1</version>
</dependency>

<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-streams</artifactId>
    <version>2.2.0</version>
</dependency>
于 2019-04-11T22:27:39.270 回答