Threads.@spawn can not run many time?

code as following:

cmid = Channel(100)
while true
    (mid::UInt32, video_name::String) = take!(cmid)
    append!(mid_list, fetch_from_list!(tasklist))
    t = Threads.@spawn get_frmkb(mid, video_name)
    @show t
    push!(tasklist, t);

after running a while, about fetched 130 from cmid, may output @show t @show(typeof(tasklist[1])) many times continuously.
Why the code wait(cmid) does not remain blocked?
What a horror!

error output as follows:
Base.IOError("could not spawn /root/.julia/artifacts/d90964dba054653e9757ab4167194a12fe864117/bin/ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 2c50300b2305dc9a0fdf35b732912047.mp4: argument list too long (E2BIG)", -7)

I can not reproduce the behaviour. When I run your script it seems to wait for something?

I have made some new progress.
1, after limiting the number of spwan threads less than Threads.nthreads() will reduce the probability of error, for example, nthreads()=8 when limiting the number of threads out of spwan to 5 when almost no error.
2, the program spwan threads inside the implementation of the function, call the library also calls spwan

Still I don’t see a way how to reproduce your problem?

There may be another problem as main cause:
download(url, path) provide not complete file to the new thread which lead to the Error ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=nokey=1:noprint_wrappers=1 2c50300b2305dc9a0fdf35b732912047.mp4.
Above is reproduced use the videos which can not open with VLM. But the size equal to the complete video which could be played.

And how to guarantee the file downloaded with download be complete?

This error proved to be error in package VideoIO. After call get_number_frames some times, the error will be reproduced.