Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » MQTT issues with FORTE running on Raspberry Pi(FORTE crashes with Segmentation Fault and characters are added to MQTT payload)
MQTT issues with FORTE running on Raspberry Pi [message #1732630] Wed, 18 May 2016 09:07 Go to next message
Herwig Eichler is currently offline Herwig EichlerFriend
Messages: 18
Registered: February 2016
Junior Member
Hi everyone,

I'd like to use MQTT to link my FORTE Installation on a Raspberry Pi based hardware to openHAB (Java OSGi Framework for Homeautomation).
I followed Monikas instructions in the FORTE documentation to compile Eclipse Paho MQTT Support into FORTE (crosscompiled on a Linux VM with Eclipse CDT Mars SR2, ok not entirely true, the Eclipse Paho MQTT C library was built in the command line without Eclipse CDT). So far everything went fine. I installed a local Mosquitto Broker on the Raspberry Pi and used a Publish FB to send some current temperature values from FORTE to the Broker. I can subscribe to the topic within my local network.
Now two things happen:
1. After a couple of cycles (cycle time 250ms) , lets say some minutes, FORTE crashes with a Segmentation fault, which seems to happen in the _IO_vprintf_internal() function according to the GDB stacktrace.
2. a character is added to my payload automatically. My identifier of the Publish FB looks like this fbdk[].mqtt[tcp://127.0.0.1:1883, forte, conmeleon/Temp]
So when I publish "247" (means 24.7°C). The subscribing MQTT Client (MQTT.fx on OSX Yosemite) receives "p247". The "p" might be the last character of the topic descriptor, but i didn't test this yet.

Any hints and tipps would be highly appreciated
Herwig

Re: MQTT issues with FORTE running on Raspberry Pi [message #1732657 is a reply to message #1732630] Wed, 18 May 2016 20:09 Go to previous messageGo to next message
Monika Wenger is currently offline Monika WengerFriend
Messages: 18
Registered: September 2015
Junior Member
Hi,

to get rid of the "p" the raw layer might help. try to use raw instead of fbdk, as follows:

raw[].mqtt[tcp://127.0.0.1:1883, forte, conmeleon/Temp]


maybe I should update the help files with that.
Re: MQTT issues with FORTE running on Raspberry Pi [message #1732658 is a reply to message #1732630] Wed, 18 May 2016 20:18 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1583
Registered: January 2014
Senior Member

Hi,

the segfault is very strange. Do you have a stack trace with more details who is calling this function?

Regarding your second issue, this is the correct behavior of the fbdk layer. The FBDK layer performs an ASN.1 encoding accourding to the Interoperability Provisions defined in the "IEC 61499 Compliance Profile for Feasibility Demonstrations" [1]. The ASN.1 encoding defines that 3 bytes are added for strings: one byte for the string identifier and two bytes for the string length. If you want to just the naked string to be sent you should have a look at the raw layer (i.e., raw[].mqtt[tcp://127.0.0.1:1883, forte, conmeleon/Temp]). This layer just takes strings as inputs or outputs of Publishers/Subscribers and hands the string on to the next layer (in your case mqtt) to be sent.

Cheers,
Alois

[1] http://holobloc.com/doc/ita/index.htm
Re: MQTT issues with FORTE running on Raspberry Pi [message #1732733 is a reply to message #1732630] Thu, 19 May 2016 10:39 Go to previous messageGo to next message
Herwig Eichler is currently offline Herwig EichlerFriend
Messages: 18
Registered: February 2016
Junior Member
Thanks Monika and Alois for your quick feedback.
I tried the raw layer and the data seems to be correct now, at least the "p" is gone.
Also FORTE runs quite stable for the last two hours and is still running. The segfaults appeared much quicker. The only thing which seems to be unusual, is that the monitoring features of the IDE stopped working after approx. 40 minutes. The watches of the IW and Publisher blocks now all show N/A even though i could see the correct values from the beginning. According to the terminal output FORTE is still working correctly and also the MQTT client subscriber gets the values.
I have attached the GDB trace if you want to investigate a little bit Wink

greetings
Herwig
Re: MQTT issues with FORTE running on Raspberry Pi [message #1733026 is a reply to message #1732733] Mon, 23 May 2016 19:57 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1583
Registered: January 2014
Senior Member

Great this is working now.

Thanks for the backtrace it very nicely shows us an issue we should definitely fix. It is a race condition in the _IO_vprintf_internal() function caused by two threads logging something in the device log. We'll need to add some interlocking mechanism there (I created an issue for that [1]). This on the other end will make the devlog even slower than it already is. Therefore it is good that we disabled per default the trace event flag [2] which led to a very high number of outputs. Furthermore I would recommend to set the default loglevel to logerror [3]. So that only where little logmessage are produced per default. This should be sufficient for most use cases.

On the long run I think we finally should really replace the DEVLOG with something less intrusive and more efficient.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=494344
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=491686
[3] https://bugs.eclipse.org/bugs/show_bug.cgi?id=494345
Re: MQTT issues with FORTE running on Raspberry Pi [message #1733057 is a reply to message #1733026] Mon, 23 May 2016 23:48 Go to previous message
Herwig Eichler is currently offline Herwig EichlerFriend
Messages: 18
Registered: February 2016
Junior Member
Hi Alois,
thanks for the update. I will compile forte with logerror, this might also do some good to the lifetime of my SD Card Wink

greetings
Herwig
Previous Topic:How to test a function block in 4DIAC?
Next Topic:prevent FORTE from tracing to syslog
Goto Forum:
  


Current Time: Fri Apr 19 21:58:47 GMT 2024

Powered by FUDForum. Page generated in 0.02960 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top