savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 130 forks source link

Error when starting main: 无法加载或初始化请求的服务提供程序 (Windows socket error 10106) #1453

Closed rsp4jack closed 3 years ago

rsp4jack commented 3 years ago

From #1372

Doc:

WSAEPROVIDERFAILEDINIT 10106 | Service provider failed to initialize.The requested service provider could not be loaded or initialized. This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.

Log:

2021/01/01 10:32:10 >>> LOG START
2021/01/01 10:32:10 [main:3] Liquidsoap 1.4.4
2021/01/01 10:32:10 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.2 menhirLib=20181113 dtools=0.4.2 duppy=0.9.0 cry=0.6.5 mm=0.5.0 xmlplaylist=0.1.5 lastfm=0.3.2 ogg=0.5.2 vorbis=0.7.1 opus=0.1.3 speex=0.2.1 mad=0.4.6 flac=0.1.7 flac.ogg=0.1.7 dynlink=[distributed with Ocaml] lame=0.3.4 gstreamer=0.3.0 fdkaac=0.3.1 theora=0.3.1 ao=0.2.1 samplerate=0.1.5 taglib=0.3.5 ssl=0.5.9 camomile=1.0.2 yojson=1.7.0 faad=0.4.0 portaudio=0.2.1 srt.types=0.1.1 srt.stubs=0.1.1 srt.stubs=0.1.1 srt=0.1.1 winsvc=1.0.0
2021/01/01 10:32:10 [gstreamer.loader:3] Loaded GStreamer 1.16.2 0
2021/01/01 10:32:10 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2021/01/01 10:32:10 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2021/01/01 10:32:10 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2021/01/01 10:32:10 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2021/01/01 10:32:10 [sandbox:3] Could not find binary bwrap, disabling sandboxing..
2021/01/01 10:32:10 [video.converter:3] Couldn't find preferred video converter: gavl.
2021/01/01 10:32:10 [audio.converter:3] Using samplerate converter: libsamplerate.
2021/01/01 10:32:10 [clock.wallclock_main:2] Error when starting main: 无法加载或初始化请求的服务提供程序。

 in socket()!
2021/01/01 10:32:10 [clock.wallclock_main:3] Raised by primitive operation at Harbor.Make.open_port.open_socket in file "harbor/harbor.ml", line 985, characters 17-54
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Stdlib__list.map in file "list.ml", line 92, characters 20-23
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Harbor.Make.open_port in file "harbor/harbor.ml", line 999, characters 31-69
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Harbor.Make.get_handler in file "harbor/harbor.ml", line 1022, characters 19-44
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Harbor.Make.add_source in file "harbor/harbor.ml", line 1032, characters 20-41
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Harbor_input.Make.http_input_server#wake_up in file "sources/harbor_input.ml", line 186, characters 10-72
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Source.operator#get_ready in file "source.ml", line 413, characters 8-31
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Source.operator#get_ready in file "source.ml", line 413, characters 8-31
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Switch.switch#wake_up.(fun) in file "operators/switch.ml", line 109, characters 10-46
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Source.operator#get_ready in file "source.ml", line 413, characters 8-31
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Source.operator#get_ready in file "source.ml", line 413, characters 8-31
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Switch.switch#wake_up.(fun) in file "operators/switch.ml", line 109, characters 10-46
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Stdlib__list.iter in file "list.ml", line 110, characters 12-15
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Source.operator#get_ready in file "source.ml", line 413, characters 8-31
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Output.output#wake_up in file "outputs/output.ml", line 134, characters 6-57
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Source.operator#get_ready in file "source.ml", line 413, characters 8-31
2021/01/01 10:32:10 [clock.wallclock_main:3] Called from Clock.clock#start_outputs.(fun) in file "clock.ml", line 228, characters 16-43
2021/01/01 10:32:10 [main:1] Got ill-balanced activations (from main)!
2021/01/01 10:32:10 [clock:2] Error when leaving output main: File "source.ml", line 435, characters 12-18: Assertion failed!
2021/01/01 10:32:10 [clock:3] Raised at Source.operator#leave.remove in file "source.ml", line 435, characters 12-24
2021/01/01 10:32:10 [clock:3] Called from Source.operator#leave in file "source.ml", line 440, characters 33-61
2021/01/01 10:32:10 [clock:3] Called from Clock.leave in file "clock.ml", line 84, characters 6-27
2021/01/01 10:32:10 [main:3] Shutdown started!
2021/01/01 10:32:10 [main:3] Waiting for main threads to terminate...
2021/01/01 10:32:10 [main:3] Threads terminated.
2021/01/01 10:32:10 [threads:3] Shutting down scheduler...
2021/01/01 10:32:10 [threads:3] Scheduler shut down.
2021/01/01 10:32:10 [threads:3] Waiting for queue threads to terminate...
2021/01/01 10:32:11 [threads:3] Queues shut down
2021/01/01 10:32:11 [main:3] Cleaning downloaded files...
2021/01/01 10:32:11 [main:3] Freeing memory...
2021/01/01 10:32:11 >>> LOG END

Script:

output.icecast(%mp3,
    host="127.0.0.1",port=8000,
    user="source",
    password="hackme",
    mount=string.concat([id,""]),
    on_error=on_error,
    mksafe(delay(5.0,radio))
)

Version details

rsp4jack commented 3 years ago

Note: liquidsoap.exe is running as Python's subprocess Python code:

subprocess.Popen(os.path.join(os.path.abspath('./liquidsoap'),"liquidsoap.exe")+' '+'../manager.liq',shell=True,cwd=os.path.abspath('./liquidsoap'),env={'SCEXRADIOID': i[0], 'PATH': env})
rsp4jack commented 3 years ago

It crash:

2021/01/01 13:59:05 >>> LOG START
2021/01/01 13:59:05 [main:3] Liquidsoap 1.4.4
2021/01/01 13:59:05 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.2 menhirLib=20181113 dtools=0.4.2 duppy=0.9.0 cry=0.6.5 mm=0.5.0 xmlplaylist=0.1.5 lastfm=0.3.2 ogg=0.5.2 vorbis=0.7.1 opus=0.1.3 speex=0.2.1 mad=0.4.6 flac=0.1.7 flac.ogg=0.1.7 dynlink=[distributed with Ocaml] lame=0.3.4 gstreamer=0.3.0 fdkaac=0.3.1 theora=0.3.1 ao=0.2.1 samplerate=0.1.5 taglib=0.3.5 ssl=0.5.9 camomile=1.0.2 yojson=1.7.0 faad=0.4.0 portaudio=0.2.1 srt.types=0.1.1 srt.stubs=0.1.1 srt.stubs=0.1.1 srt=0.1.1 winsvc=1.0.0
2021/01/01 13:59:05 [gstreamer.loader:3] Loaded GStreamer 1.16.2 0
2021/01/01 13:59:05 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2021/01/01 13:59:05 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2021/01/01 13:59:05 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2021/01/01 13:59:05 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2021/01/01 13:59:05 [decoder:3] Method "OGG" accepted "C:/Users/051130/Desktop/scex_radio/radio/default.ogg".
2021/01/01 13:59:05 [sandbox:3] Could not find binary bwrap, disabling sandboxing..
2021/01/01 13:59:05 [video.converter:3] Couldn't find preferred video converter: gavl.
2021/01/01 13:59:05 [audio.converter:3] Using samplerate converter: libsamplerate.
2021/01/01 13:59:05 [bellad(dot)m3u8:3] Loading playlist...
2021/01/01 13:59:05 [bellad(dot)m3u8:3] No mime type specified, trying autodetection.
2021/01/01 13:59:05 [bellad(dot)m3u8:3] Playlist treated as format application/x-mpegURL
2021/01/01 13:59:05 [bellad(dot)m3u8:3] Successfully loaded a playlist of 3 tracks.
2021/01/01 13:59:05 [main(dot)m3u8:3] Loading playlist...
2021/01/01 13:59:05 [main(dot)m3u8:3] No mime type specified, trying autodetection.
2021/01/01 13:59:05 [main(dot)m3u8:3] Playlist treated as format application/x-mpegURL
2021/01/01 13:59:05 [main(dot)m3u8:3] Successfully loaded a playlist of 19 tracks.
2021/01/01 13:59:05 [single_8517:3] "C:/Users/051130/Desktop/scex_radio/radio/default.ogg" is static, resolving once for all...
2021/01/01 13:59:05 [single_8517:3] Prepared "C:/Users/051130/Desktop/scex_radio/radio/default.ogg" (RID 0).
2021/01/01 13:59:05 [main:3] Connecting mount main for source@127.0.0.1...
2021/01/01 13:59:05 [main:2] Connection failed: Not_found
2021/01/01 13:59:05 [clock.wallclock_main:2] Error when starting output main: Not_found!
Raised at Stdlib__map.Make.find in file "map.ml", line 136, characters 10-25
Called from CamlinternalOO.new_variable in file "camlinternalOO.ml", line 259, characters 6-31
Called from Cry.resolve_host in file "src/cry.ml", line 479, characters 24-49
Called from Cry.connect in file "src/cry.ml", line 583, characters 33-57
Called from Icecast2.output#icecast_start in file "outputs/icecast2.ml", line 581, characters 8-37
Re-raised at Icecast2.output#icecast_start in file "outputs/icecast2.ml", line 596, characters 13-20
Called from Start_stop.base#do_start in file "tools/start_stop.ml", line 108, characters 8-18
Called from Clock.clock#start_outputs.(fun) in file "clock.ml", line 245, characters 20-38

2021/01/01 13:59:05 [procol.external:3] Failed to fetch mime-type for http://49.233.66.25/media/audio/Masketta%20Fall%20-%20Big%20Dog.mp3.
2021/01/01 13:59:05 [procol.external:3] No known file extension for mime: 
2021/01/01 13:59:05 [procol.external:3] Failed to fetch mime-type for http://49.233.66.25/media/bellad/sec_Ad.ogg.
2021/01/01 13:59:05 [procol.external:3] No known file extension for mime: 
2021/01/01 13:59:05 [threads:2] Queue generic queue #2 crashed with exception Exec format error in open_process_shell(curl -sL "http://49.233.66.25/media/audio/Masketta%20Fall%20-%20Big%20Dog.mp3" -o ".\\liq-process918146.osb")
Raised at Unix.open_process_shell in file "unix.ml", line 1077, characters 22-75
Called from Unix.open_process_full in file "unix.ml" (inlined), line 1086, characters 2-50
Called from Process_handler.open_process in file "tools/process_handler.ml", line 26, characters 30-60
Called from Process_handler.run.create in file "tools/process_handler.ml", line 144, characters 12-36
Called from Process_handler.run in file "tools/process_handler.ml", line 165, characters 16-25
Called from Builtins_process.(fun).asynchronous.(fun) in file "lang/builtins_process.ml", line 208, characters 14-104
Called from Tutils.finalize in file "tools/tutils.ml", line 98, characters 12-16
Re-raised at Tutils.finalize in file "tools/tutils.ml", line 103, characters 4-11
Called from Builtins_process.(fun).asynchronous in file "lang/builtins_process.ml", line 183, characters 8-1023
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Lang_values.eval in file "lang/lang_values.ml", line 901, characters 16-27
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Tutils.finalize in file "tools/tutils.ml", line 98, characters 12-16
Re-raised at Tutils.finalize in file "tools/tutils.ml", line 103, characters 4-11
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Tutils.finalize in file "tools/tutils.ml", line 98, characters 12-16
Re-raised at Tutils.finalize in file "tools/tutils.ml", line 103, characters 4-11
Called from Builtins_resolvers.(fun) in file "lang/builtins_resolvers.ml", line 158, characters 12-234
Called from Request.resolve.resolve_step in file "request.ml", line 582, characters 20-64
Called from Request_source.queued#prefetch in file "sources/request_source.ml", line 353, characters 18-45
Called from Request_source.queued#feed_queue in file "sources/request_source.ml", line 338, characters 14-27
Called from Duppy.Async.add.task in file "src/duppy.ml", line 371, characters 20-24
Called from Duppy.Task.t_of_task.(fun) in file "src/duppy.ml", line 146, characters 50-66
Called from Duppy.exec in file "src/duppy.ml", line 268, characters 12-21
Called from Duppy.queue.run in file "src/duppy.ml", line 300, characters 7-24
Called from Duppy.queue in file "src/duppy.ml", line 340, characters 6-10
Called from Tutils.new_queue.queue in file "tools/tutils.ml", line 225, characters 18-54

2021/01/01 13:59:05 [threads:1] PANIC: Liquidsoap has crashed, exiting.,
Please report at: savonet-users@lists.sf.net
2021/01/01 13:59:05 [threads:2] Queue generic queue #1 crashed with exception Exec format error in open_process_shell(curl -sL "http://49.233.66.25/media/bellad/sec_Ad.ogg" -o ".\\liq-processee8db5.osb")
Raised at Unix.open_process_shell in file "unix.ml", line 1077, characters 22-75
Called from Unix.open_process_full in file "unix.ml" (inlined), line 1086, characters 2-50
Called from Process_handler.open_process in file "tools/process_handler.ml", line 26, characters 30-60
Called from Process_handler.run.create in file "tools/process_handler.ml", line 144, characters 12-36
Called from Process_handler.run in file "tools/process_handler.ml", line 165, characters 16-25
Called from Builtins_process.(fun).asynchronous.(fun) in file "lang/builtins_process.ml", line 208, characters 14-104
Called from Tutils.finalize in file "tools/tutils.ml", line 98, characters 12-16
Re-raised at Tutils.finalize in file "tools/tutils.ml", line 103, characters 4-11
Called from Builtins_process.(fun).asynchronous in file "lang/builtins_process.ml", line 183, characters 8-1023
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Lang_values.eval in file "lang/lang_values.ml", line 901, characters 16-27
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Tutils.finalize in file "tools/tutils.ml", line 98, characters 12-16
Re-raised at Tutils.finalize in file "tools/tutils.ml", line 103, characters 4-11
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Lang_values.apply in file "lang/lang_values.ml", line 980, characters 12-18
Called from Tutils.finalize in file "tools/tutils.ml", line 98, characters 12-16
Re-raised at Tutils.finalize in file "tools/tutils.ml", line 103, characters 4-11
Called from Builtins_resolvers.(fun) in file "lang/builtins_resolvers.ml", line 158, characters 12-234
Called from Request.resolve.resolve_step in file "request.ml", line 582, characters 20-64
Called from Request_source.queued#prefetch in file "sources/request_source.ml", line 353, characters 18-45
Called from Request_source.queued#feed_queue in file "sources/request_source.ml", line 338, characters 14-27
Called from Duppy.Async.add.task in file "src/duppy.ml", line 371, characters 20-24
Called from Duppy.Task.t_of_task.(fun) in file "src/duppy.ml", line 146, characters 50-66
Called from Duppy.exec in file "src/duppy.ml", line 268, characters 12-21
Called from Duppy.queue.run in file "src/duppy.ml", line 300, characters 7-24
Called from Duppy.queue in file "src/duppy.ml", line 340, characters 6-10
Called from Tutils.new_queue.queue in file "tools/tutils.ml", line 225, characters 18-54

2021/01/01 13:59:05 [threads:1] PANIC: Liquidsoap has crashed, exiting.,
Please report at: savonet-users@lists.sf.net

Python code:

subprocess.Popen(os.path.join(os.path.abspath('./liquidsoap'),"liquidsoap.exe")+' '+'../manager.liq',shell=False,cwd=os.path.abspath('./liquidsoap'),env={'SCEXRADIOID': i[0], 'PATH': env})
toots commented 3 years ago

Hi! Thanks for the report. Do you know what the message means?

rsp4jack commented 3 years ago

Do you read "socket error 10106" in title?

toots commented 3 years ago

I can but any supplemental information help to get a quicker solution. Here's the description on the error from the online documentation available at: https://docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2

WSAEPROVIDERFAILEDINIT 10106 Service provider failed to initialize.The requested service provider could not be loaded or initialized. This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.

Since you are running the binary inside a specific environment (python), I believe the first check would be to see if your runtime environment is hiding or causing issues with DLL loading or startup functions, as documented above.

rsp4jack commented 3 years ago

It's cause by error environment variables. WinSock need SYSTEMROOT variable, but my program doesn't set environment variables correct.

rsp4jack commented 3 years ago

From Stack Overflow: Why does Windows not allow WinSock to be started while impersonating another user