sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
107 stars 63 forks source link

`lsl_get_xml` is not deterministic. #127

Closed cboulay closed 3 years ago

cboulay commented 3 years ago

I'm using pylsl for my testing, but I don't see how that can be at fault given that I'm just looking at the return of lib.lsl_get_xml(self.obj). Below in the collapsed details are the returns of 5 consecutive calls. Only the 4th appears to be correct. The second seems to have the last few bytes repeated. The others seem to have extra garbage added to the tail.

This is with my own tests in some separate software. I repeated the above with SendDataAdvanced.py, 2/5 were good, the rest had the same junk appended to the tail.

``` b'\n\n\tTest EEG Stream\n\tEEG\n\t3\n\tdouble64\n\tnpype_test_0\n\t512.0000000000000\n\t1.100000000000000\n\t34853.85875440000\n\tb0b50389-1801-4027-9883-7616a3be6032\n\tdefault\n\tDESKTOP-8HB5T46\n\t\n\t16572\n\t16572\n\t\n\t16572\n\t16572\n\t\n\t\tUnitTest\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t1\n\t\t\t\t\t-1\n\t\t\t\t\t10\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t2\n\t\t\t\t\t-2\n\t\t\t\t\t11\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t3\n\t\t\t\t\t-3\n\t\t\t\t\t12\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n\ncol\xda\x03hotz\ntheta/beta\xda\x04PRGn\xe7' b'\n\n\tTest EEG Stream\n\tEEG\n\t3\n\tdouble64\n\tnpype_test_0\n\t512.0000000000000\n\t1.100000000000000\n\t34853.85875440000\n\tb0b50389-1801-4027-9883-7616a3be6032\n\tdefault\n\tDESKTOP-8HB5T46\n\t\n\t16572\n\t16572\n\t\n\t16572\n\t16572\n\t\n\t\tUnitTest\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t1\n\t\t\t\t\t-1\n\t\t\t\t\t10\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t2\n\t\t\t\t\t-2\n\t\t\t\t\t11\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t3\n\t\t\t\t\t-3\n\t\t\t\t\t12\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n\ns>\n\t\n\n' b'\n\n\tTest EEG Stream\n\tEEG\n\t3\n\tdouble64\n\tnpype_test_0\n\t512.0000000000000\n\t1.100000000000000\n\t34853.85875440000\n\tb0b50389-1801-4027-9883-7616a3be6032\n\tdefault\n\tDESKTOP-8HB5T46\n\t\n\t16572\n\t16572\n\t\n\t16572\n\t16572\n\t\n\t\tUnitTest\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t1\n\t\t\t\t\t-1\n\t\t\t\t\t10\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t2\n\t\t\t\t\t-2\n\t\t\t\t\t11\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t3\n\t\t\t\t\t-3\n\t\t\t\t\t12\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n\nlsrq' b'\n\n\tTest EEG Stream\n\tEEG\n\t3\n\tdouble64\n\tnpype_test_0\n\t512.0000000000000\n\t1.100000000000000\n\t34853.85875440000\n\tb0b50389-1801-4027-9883-7616a3be6032\n\tdefault\n\tDESKTOP-8HB5T46\n\t\n\t16572\n\t16572\n\t\n\t16572\n\t16572\n\t\n\t\tUnitTest\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t1\n\t\t\t\t\t-1\n\t\t\t\t\t10\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t2\n\t\t\t\t\t-2\n\t\t\t\t\t11\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t3\n\t\t\t\t\t-3\n\t\t\t\t\t12\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n\n' b'\n\n\tTest EEG Stream\n\tEEG\n\t3\n\tdouble64\n\tnpype_test_0\n\t512.0000000000000\n\t1.100000000000000\n\t34853.85875440000\n\tb0b50389-1801-4027-9883-7616a3be6032\n\tdefault\n\tDESKTOP-8HB5T46\n\t\n\t16572\n\t16572\n\t\n\t16572\n\t16572\n\t\n\t\tUnitTest\n\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t1\n\t\t\t\t\t-1\n\t\t\t\t\t10\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t2\n\t\t\t\t\t-2\n\t\t\t\t\t11\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\tmicrovolts\n\t\t\t\tEEG\n\t\t\t\t\n\t\t\t\t\t3\n\t\t\t\t\t-3\n\t\t\t\t\t12\n\t\t\t\t\n\t\t\t\n\t\t\n\t\n\nt\xd1N\xcf\x01' ```
cboulay commented 3 years ago

Just confirming that I get the same when debugging ReceiveDataC in VS2019 with SendDataC (Debug) running in the background.

First try:

<?xml version="1.0"?>
<info>
    <name>SendDataC</name>
    <type>EEG</type>
    <channel_count>8</channel_count>
    <channel_format>float32</channel_format>
    <source_id>325wqer4354</source_id>
    <nominal_srate>500.0000000000000</nominal_srate>
    <version>1.100000000000000</version>
    <created_at>36158.48481850000</created_at>
    <uid>c4aa7138-e565-4a8f-bddf-39adea3a3b2b</uid>
    <session_id>default</session_id>
    <hostname>DESKTOP-8HB5T46</hostname>
    <v4address />
    <v4data_port>16572</v4data_port>
    <v4service_port>16572</v4service_port>
    <v6address />
    <v6data_port>16572</v6data_port>
    <v6service_port>16572</v6service_port>
    <desc />
</info>
ÍýýýýÝÝÝÝÝÝÝÝÝÝݴжhðo

Second try

<?xml version="1.0"?>
<info>
    <name>SendDataC</name>
    <type>EEG</type>
    <channel_count>8</channel_count>
    <channel_format>float32</channel_format>
    <source_id>325wqer4354</source_id>
    <nominal_srate>500.0000000000000</nominal_srate>
    <version>1.100000000000000</version>
    <created_at>36158.48481850000</created_at>
    <uid>c4aa7138-e565-4a8f-bddf-39adea3a3b2b</uid>
    <session_id>default</session_id>
    <hostname>DESKTOP-8HB5T46</hostname>
    <v4address />
    <v4data_port>16572</v4data_port>
    <v4service_port>16572</v4service_port>
    <v6address />
    <v6data_port>16572</v6data_port>
    <v6service_port>16572</v6service_port>
    <desc />
</info>
ÍýýýýÝÝÝÝÝÝÝÝÝÝÝǪP>yè
cboulay commented 3 years ago

It appears to be the same strcpy --> memcpy problem as the other recent issue & reversion.

https://github.com/sccn/liblsl/commit/ece288b60284694f748f36a8db23e8e232bd5519

In this case I fixed it by setting the final value to '\0'. Seems to be OK so far.