Skip to content

lsl_have_consumers always returns 'true' #267

Description

@jseyelink

Problem

Function lsl_have_consumers( ) from lsl_c.h always returns true. This persists even when there are no longer any consumers.

Environment

Linux display-desktop 6.8.0-101-generic #101~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 11 13:19:54 UTC x86_64 x86_64 x86_64 GNU/Linux

gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

cmake version 4.2.3

Test program

CMakeLists.txt
main.c

Steps to replicate

  1. Build test program.
  2. Run test program. This will now wait for a consumer.
  3. Run LabRecorder.
  4. From LabRecorder:
    a. Select the Test stream.
    b. Start recording.
  5. The test program will now begin printing the return value that it receives from repeated calls to lsl_have_consumers( ).
  6. From LabRecorder:
    a. Stop recording.
    b. Deselect the Test stream.
    c. Close the program.
  7. Use Ctrl-C to end the test program, which is still running.

Example session

From terminal with test program,

$ ./build/lsl-haveconsumer-test 
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'lo' (status: 1, multicast: 0, broadcast: 0)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'enp3s0' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'enp0s31f6' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'lo' (status: 1, multicast: 0, broadcast: 0)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'enp3s0' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:102   INFO| 	IPv4 addr: 64010102
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'enp0s31f6' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:102   INFO| 	IPv4 addr: a23074a
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'lo' (status: 1, multicast: 0, broadcast: 0)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:89    INFO| netif 'enp3s0' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::bab3:e1a5:6cb1:8254%enp3s0
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]         api_config.cpp:270   INFO| Loaded default config
LSL version information
    library   1.16
    protocol  1.10
    lib info  git:6ca188c266c21f7228dc67077303fa6abaf2e8be/branch:refs/tags/v1.16.2/build:Release/compiler:GNU-11.3.0/link:SHARED
2026-03-05 14:42:27.815 (   0.000s) [lsl-haveconsume ]             common.cpp:65    INFO| git:6ca188c266c21f7228dc67077303fa6abaf2e8be/branch:refs/tags/v1.16.2/build:Release/compiler:GNU-11.3.0/link:SHARED
lsl_have_consumers 0 return 1
lsl_have_consumers 1 return 1
lsl_have_consumers 2 return 1
lsl_have_consumers 3 return 1
lsl_have_consumers 4 return 1
lsl_have_consumers 5 return 1
lsl_have_consumers 6 return 1
lsl_have_consumers 7 return 1
lsl_have_consumers 8 return 1
lsl_have_consumers 9 return 1
lsl_have_consumers 10 return 1
lsl_have_consumers 11 return 1
lsl_have_consumers 12 return 1
lsl_have_consumers 13 return 1
lsl_have_consumers 14 return 1
lsl_have_consumers 15 return 1
lsl_have_consumers 16 return 1
lsl_have_consumers 17 return 1
lsl_have_consumers 18 return 1
lsl_have_consumers 19 return 1
lsl_have_consumers 20 return 1
lsl_have_consumers 21 return 1
lsl_have_consumers 22 return 1
lsl_have_consumers 23 return 1
lsl_have_consumers 24 return 1
lsl_have_consumers 25 return 1
lsl_have_consumers 26 return 1
lsl_have_consumers 27 return 1
lsl_have_consumers 28 return 1
lsl_have_consumers 29 return 1
lsl_have_consumers 30 return 1
lsl_have_consumers 31 return 1
lsl_have_consumers 32 return 1
^CHandled signal 2
lsl_have_consumers final return 1

From terminal with LabRecorder,

$ LabRecorder
"LabRecorder.cfg"
"/home/display/Documents/Jira/API-3375/LabRecorder.cfg"
"/home/display/.config/LabRecorder/LabRecorder.cfg"
"/etc/xdg/xdg-ubuntu/LabRecorder/LabRecorder.cfg"
"/etc/xdg/LabRecorder/LabRecorder.cfg"
"/home/display/.local/share/LabRecorder/LabRecorder.cfg"
"/usr/share/ubuntu/LabRecorder/LabRecorder.cfg"
"/usr/share/gnome/LabRecorder/LabRecorder.cfg"
"/usr/local/share/LabRecorder/LabRecorder.cfg"
"/usr/share/LabRecorder/LabRecorder.cfg"
loading config file  "/usr/share/LabRecorder/LabRecorder.cfg"
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'lo' (status: 1, multicast: 0, broadcast: 0)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'enp3s0' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'enp0s31f6' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'lo' (status: 1, multicast: 0, broadcast: 0)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'enp3s0' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:102   INFO| 	IPv4 addr: 64010102
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'enp0s31f6' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:102   INFO| 	IPv4 addr: a23074a
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'lo' (status: 1, multicast: 0, broadcast: 0)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:89    INFO| netif 'enp3s0' (status: 1, multicast: 4096, broadcast: 2)
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::bab3:e1a5:6cb1:8254%enp3s0
2026-03-05 14:42:30.315 (   0.055s) [LabRecorder     ]         api_config.cpp:270   INFO| Loaded default config
Missing:  QSet()
2026-03-05 14:42:39.046 (   8.787s) [LabRecorder     ]             common.cpp:65    INFO| git:6ca188c266c21f7228dc67077303fa6abaf2e8be/branch:refs/tags/v1.16.2/build:Release/compiler:GNU-11.3.0/link:SHARED
Opened the stream Test.
Received header for stream Test.
Started data collection for stream Test.
Offsets thread is finished
Wrote footer for stream Test.
Closing the file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions