beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vassil Kolarov (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (BEAM-1829) MQTT message compression not working on Rapsberry Pi
Date Tue, 04 Apr 2017 09:15:41 GMT

    [ https://issues.apache.org/jira/browse/BEAM-1829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15954877#comment-15954877
] 

Vassil Kolarov commented on BEAM-1829:
--------------------------------------

Hi,
Everything seems good with 0.5.0 and 0.6.0. However, I have problem with the HEAD branch.
After receiving 10 messages (just the digits from 0 to 9), I got:
Apr 04, 2017 9:53:53 AM org.apache.activemq.broker.BrokerService stop
INFO: Apache ActiveMQ 5.14.0 (localhost, ID:desktop-102016-46309-1491296007388-0:1) is shutting
down

{code}
java.lang.RuntimeException: org.apache.beam.sdk.coders.CoderException: 109 unexpected extra
bytes after decoding org.apache.beam.sdk.io.mqtt.MqttIO$MqttCheckpointMark@79aa5a4

	at org.apache.beam.runners.direct.DirectRunner$DirectPipelineResult.waitUntilFinish(DirectRunner.java:458)
	at org.apache.beam.runners.direct.DirectRunner$DirectPipelineResult.waitUntilFinish(DirectRunner.java:427)
	at org.apache.beam.runners.direct.DirectRunner.run(DirectRunner.java:297)
	at org.apache.beam.runners.direct.DirectRunner.run(DirectRunner.java:68)
	at org.apache.beam.sdk.Pipeline.run(Pipeline.java:266)
	at org.apache.beam.examples.mqtt.MqttPipelineTest.testPipeline(MqttPipelineTest.java:155)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.apache.beam.sdk.testing.TestPipeline$1.evaluate(TestPipeline.java:287)
	at org.apache.beam.sdk.testing.TestPipeline$1.evaluate(TestPipeline.java:287)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.beam.sdk.coders.CoderException: 109 unexpected extra bytes after decoding
org.apache.beam.sdk.io.mqtt.MqttIO$MqttCheckpointMark@79aa5a4
	at org.apache.beam.sdk.util.CoderUtils.decodeFromByteArray(CoderUtils.java:145)
	at org.apache.beam.sdk.util.CoderUtils.decodeFromByteArray(CoderUtils.java:136)
	at org.apache.beam.sdk.util.CoderUtils.clone(CoderUtils.java:185)
	at org.apache.beam.runners.direct.UnboundedReadEvaluatorFactory$UnboundedReadEvaluator.getReader(UnboundedReadEvaluatorFactory.java:192)
	at org.apache.beam.runners.direct.UnboundedReadEvaluatorFactory$UnboundedReadEvaluator.processElement(UnboundedReadEvaluatorFactory.java:128)
	at org.apache.beam.runners.direct.TransformExecutor.processElements(TransformExecutor.java:139)
	at org.apache.beam.runners.direct.TransformExecutor.run(TransformExecutor.java:107)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
{code}

This is with 0.7.0-SNAPSHOT, compiled from source, with no changes. 

Here is the test pipeline:
{code}
    public Pipeline createPipeline() throws Exception {

        final int limit = conf.resolve(options).getInt("pipeline.limit");;

        PipelineOptions pipelineOptions = PipelineOptionsFactory.create();
        Pipeline p = Pipeline.create(pipelineOptions);

        p.apply(MqttIO.read()
                      .withConnectionConfiguration(
                        MqttIO.ConnectionConfiguration.create(
                                "tcp://" + MQTT_HOST + ":" + MQTT_PORT,
                                MQTT_TOPIC,
                                MQTT_CLIENT_ID))
                ).setCoder(ByteArrayCoder.of())
         .apply(ParDo.of(new DoFn<byte[], byte[]>() {
             @ProcessElement
             public void processElement(ProcessContext c) {
                 LOG.info("Got message: {}", new String(c.element()));
                 Integer i = Integer.parseInt(new String(c.element()));

                 if(i > limit){
                     c.output(i.toString().getBytes());
                 }
             }
         })).setCoder(ByteArrayCoder.of())
         .apply(MqttIO.write()
                      .withConnectionConfiguration(
                                MqttIO.ConnectionConfiguration.create(
                                        "tcp://" + REMOTE_MQTT_HOST + ":" + REMOTE_MQTT_PORT,
                                        REMOTE_MQTT_TOPIC)));
        return p;
    }
{code}

and the message publisher:

{code}
    public void publisher() throws Exception {
        MQTT client = new MQTT();
        client.setHost("tcp://"+host+":" + port);
        final BlockingConnection publishConnection = client.blockingConnection();
        publishConnection.connect();
        Thread publisherThread = new Thread() {
            public void run() {
                try {
                    for (int i = 0; i < 2000000; i++) {
                        publishConnection.publish("test_topic", Integer.toString(i).getBytes(),
                                QoS.AT_LEAST_ONCE, false);
                        Thread.sleep(1000);

                    }
                } catch (Exception e) {
                    // nothing to do
                }
            }
        };
        publisherThread.start();
        publisherThread.join();
    }
{code}



> MQTT message compression not working on Rapsberry Pi
> ----------------------------------------------------
>
>                 Key: BEAM-1829
>                 URL: https://issues.apache.org/jira/browse/BEAM-1829
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-extensions
>    Affects Versions: 0.6.0
>            Reporter: Vassil Kolarov
>            Assignee: Jean-Baptiste Onofré
>              Labels: MQTT, Snappy
>
> Most probably due to this bug: https://github.com/xerial/snappy-java/issues/147, the
following exception is raised, when running on Raspberry Pi:
> Exception in thread "main" java.lang.UnsatisfiedLinkError: /root/~/tmp/snappy-1.1.2-3c6134d1-26c5-4fb0-b6c9-669d4848d15b-libsnappyjava.so:
/root/~/tmp/snappy-1.1.2-3c6134d1-26c5-4fb0-b6c9-669d4848d15b-libsn
> appyjava.so: cannot open shared object file: No such file or directory
>         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
>         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
>         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1814)
>         at java.lang.Runtime.load0(Runtime.java:809)
>         at java.lang.System.load(System.java:1083)
>         at org.xerial.snappy.SnappyLoader.loadNativeLibrary(SnappyLoader.java:174)
>         at org.xerial.snappy.SnappyLoader.load(SnappyLoader.java:152)
>         at org.xerial.snappy.Snappy.<clinit>(Snappy.java:46)
>         at org.xerial.snappy.SnappyOutputStream.<init>(SnappyOutputStream.java:97)
>         at org.xerial.snappy.SnappyOutputStream.<init>(SnappyOutputStream.java:89)
>         at org.xerial.snappy.SnappyOutputStream.<init>(SnappyOutputStream.java:79)
>         at org.apache.beam.sdk.util.SerializableUtils.serializeToByteArray(SerializableUtils.java:48)
>         at org.apache.beam.sdk.util.SerializableUtils.ensureSerializable(SerializableUtils.java:83)
>         at org.apache.beam.sdk.io.Read$Unbounded.<init>(Read.java:141)
>         at org.apache.beam.sdk.io.Read$Unbounded.<init>(Read.java:136)
>         at org.apache.beam.sdk.io.Read.from(Read.java:56)
>         at org.apache.beam.sdk.io.mqtt.MqttIO$Read.expand(MqttIO.java:274)
>         at org.apache.beam.sdk.io.mqtt.MqttIO$Read.expand(MqttIO.java:221)
>         at org.apache.beam.sdk.runners.PipelineRunner.apply(PipelineRunner.java:76)
>         at org.apache.beam.runners.direct.DirectRunner.apply(DirectRunner.java:296)
>         at org.apache.beam.sdk.Pipeline.applyInternal(Pipeline.java:388)
>         at org.apache.beam.sdk.Pipeline.applyTransform(Pipeline.java:302)
>         at org.apache.beam.sdk.values.PBegin.apply(PBegin.java:47)
>         at org.apache.beam.sdk.Pipeline.apply(Pipeline.java:152)
>         at org.blah.beam.MqttPipeline.main(MqttPipeline.java:37)
> Increasing the snappy version to 1.1.4 will probably fix the issue.
> Best regards,
> Vassil



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message