awslabs / amazon-kinesis-video-streams-producer-c

https://awslabs.github.io/amazon-kinesis-video-streams-producer-c/group__PublicMemberFunctions.html
Apache License 2.0
56 stars 72 forks source link

[QUESTION] Getting SEG Fault in describeStreamCurlHandler() in Alpine Docker container #215

Closed Prasad-Elear closed 3 years ago

Prasad-Elear commented 3 years ago

A one liner description about the use case and what you are trying to achieve

Logging Below are the logs that I obtained, ./kvsVideoOnlyStreamingSample srujan 10 h264SampleFrames/ 2021-05-07 11:00:47 INFO heapInitialize(): Initializing native heap with limit size 20971520, spill ratio 0% and flags 0x00000002 2021-05-07 11:00:47 INFO heapInitialize(): Creating system heap. 2021-05-07 11:00:47 INFO heapInitialize(): Heap is initialized OK 2021-05-07 11:00:47 DEBUG stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002 2021-05-07 11:00:47 DEBUG stepStateMachine(): State Machine - Current state: 0x0000000000000002, Next state: 0x0000000000000010 2021-05-07 11:00:47 INFO createDeviceResultEvent(): Create device result event. 2021-05-07 11:00:47 DEBUG stepStateMachine(): State Machine - Current state: 0x0000000000000010, Next state: 0x0000000000000040 2021-05-07 11:00:47 INFO createKinesisVideoStream(): Creating Kinesis Video Stream. 2021-05-07 11:00:47 DEBUG logStreamInfo(): Kinesis Video Stream Info 2021-05-07 11:00:47 DEBUG logStreamInfo(): Stream name: srujan 2021-05-07 11:00:47 DEBUG logStreamInfo(): Streaming type: STREAMING_TYPE_REALTIME 2021-05-07 11:00:47 DEBUG logStreamInfo(): Content type: video/h264 2021-05-07 11:00:47 DEBUG logStreamInfo(): Max latency (100ns): 314500000 2021-05-07 11:00:47 DEBUG logStreamInfo(): Fragment duration (100ns): 20000000 2021-05-07 11:00:47 DEBUG logStreamInfo(): Key frame fragmentation: Yes 2021-05-07 11:00:47 DEBUG logStreamInfo(): Use frame timecode: Yes 2021-05-07 11:00:47 DEBUG logStreamInfo(): Absolute frame timecode: Yes 2021-05-07 11:00:47 DEBUG logStreamInfo(): Nal adaptation flags: 40 2021-05-07 11:00:47 DEBUG logStreamInfo(): Average bandwith (bps): 2097152 2021-05-07 11:00:47 DEBUG logStreamInfo(): Framerate: 120 2021-05-07 11:00:47 DEBUG logStreamInfo(): Buffer duration (100ns): 370000000 2021-05-07 11:00:47 DEBUG logStreamInfo(): Replay duration (100ns): 185000000 2021-05-07 11:00:47 DEBUG logStreamInfo(): Connection Staleness duration (100ns): 50000000 2021-05-07 11:00:47 DEBUG logStreamInfo(): Store Pressure Policy: 1 2021-05-07 11:00:47 DEBUG logStreamInfo(): View Overflow Policy: 1 2021-05-07 11:00:47 DEBUG logStreamInfo(): Segment UUID: NULL 2021-05-07 11:00:47 DEBUG logStreamInfo(): Frame ordering mode: 0 2021-05-07 11:00:47 DEBUG logStreamInfo(): Track list 2021-05-07 11:00:47 DEBUG logStreamInfo(): Track id: 1 2021-05-07 11:00:47 DEBUG logStreamInfo(): Track name: kvs_video_track 2021-05-07 11:00:47 DEBUG logStreamInfo(): Codec id: V_MPEG4/ISO/AVC 2021-05-07 11:00:47 DEBUG logStreamInfo(): Track type: TRACK_INFO_TYPE_VIDEO 2021-05-07 11:00:47 DEBUG logStreamInfo(): Track cpd: NULL 2021-05-07 11:00:47 DEBUG stepStateMachine(): State Machine - Current state: 0x0000000000000001, Next state: 0x0000000000000002 Segmentation fault (core dumped)

coredump file logs: For bug reporting instructions, please see: http://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /home/prasad/amazon-kinesis-video-streams-producer-c/conan_build/kvsVideoOnlyStreamingSample...done.

warning: core file may not match specified executable file. [New LWP 19063] [New LWP 19062]

warning: Can't read pathname for load map: Unknown error -1.

warning: .dynamic section for "/usr/local/lib/libcproducer.so" is not at the expected address (wrong library or version mismatch?)

warning: .dynamic section for "/usr/local/lib/libcurl.so" is not at the expected address (wrong library or version mismatch?)

warning: Could not load shared library symbols for /lib/ld-musl-x86_64.so.1. Do you need "set solib-search-path" or "set sysroot"? Core was generated by `./kvsVideoOnlyStreamingSample srujan 10 h264SampleFrames/'. Program terminated with signal SIGSEGV, Segmentation fault.

0 0x00007f5617da4461 in describeStreamCurlHandler () from /usr/local/lib/libcproducer.so

[Current thread is 1 (LWP 19063)] (gdb) bt

0 0x00007f5617da4461 in describeStreamCurlHandler () from /usr/local/lib/libcproducer.so

Backtrace stopped: Cannot access memory at address 0x7f5618444fb8 (gdb)

Please help me resolve this issue. PS: I am running the sample provided in https://github.com/awslabs/amazon-kinesis-video-streams-producer-c

I am running it in Alpine Docker container

disa6302 commented 3 years ago

@Prasad-Elear ,

This is not reproducible on our end and the backtrace does not fetch a lot of information. Are you able to reproduce this on a non docker set up?

Prasad-Elear commented 3 years ago

@disa6302 Thanks for trying to reproduce this issue from your side. I figure that That issue is due to the stack size of threads in alpine is limited to 80Kb, So I added CONSTRAINED_DEVICE Macro and recompiled it again, which makes the thread stack to 0.5MB. This fix is working fine.

That would be great if this macro can be automatically added by the CMakeLists.txt when it recognises for which build system it is compiling.

disa6302 commented 3 years ago

Great! Resolving the issue then

disa6302 commented 3 years ago

@Prasad-Elear ,

I see you edited your comment. We will look into adding the option. Additionally, we welcome contributions and if you are interested, feel free to open a PR and we can review it