Cleaning up after shmsink crash

I got a pipeline to an shmsink element, which is used on command line and in a c-application:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=640,height=480,framerate=60/1 ! queue ! vpuenc_h264 ! queue ! shmsink socket-path=/tmp/gst_shm sync=true wait-for-connection=false shm-size=1000000

It works fine wit gst-launch-1.0

But when started with gst_parse_launch inside the c application it freezes after a few seconds. Seemingly producing the same output file size as the shm-buffer-size. After the crash the socket files are left behind. Even if these are remove by “rm /tmp/gst_shm” the application still can not be restarted. The pipeline will not enter playing state. Only after the system is restarted, I can get the pipeline to work again.

Any Ideas what could cause this?