tphakala / birdnet-go

Realtime BirdNET soundscape analyzer
Other
183 stars 19 forks source link

Crash when listening to multiple RTSPS streams #296

Closed jdoss closed 6 hours ago

jdoss commented 2 days ago

I just setup BirdNet-Go in a container and I configured it to listen to four Unifi Protect cameras and it was working great until it crashed with the following error. This is with the latest container tag.

fatal error: concurrent map writes

goroutine 102 [running]:
github.com/tphakala/birdnet-go/internal/myaudio.readFromBuffer({0xc0003eff80, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/buffers.go:91 +0x191
github.com/tphakala/birdnet-go/internal/myaudio.BufferMonitor(0x0?, 0xc0003cd220, 0xc000125da0, {0xc0003eff80, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/buffers.go:117 +0x13e
created by github.com/tphakala/birdnet-go/internal/analysis.RealtimeAnalysis in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/realtime.go:123 +0x7bd

goroutine 1 [select, 23 minutes]:
github.com/tphakala/birdnet-go/internal/analysis.RealtimeAnalysis(0xc000382a88)
        /root/src/BirdNET-Go/internal/analysis/realtime.go:142 +0x9f8
github.com/tphakala/birdnet-go/cmd/realtime.Command.func1(0xc0003b4c08?, {0xf324dd?, 0x4?, 0xf323cd?})
        /root/src/BirdNET-Go/cmd/realtime/realtime.go:20 +0x17
github.com/spf13/cobra.(*Command).execute(0xc0003b4c08, {0x5ffaac0, 0x0, 0x0})
        /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0003b4308)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0xc000382a88?)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x13
main.main()
        /root/src/BirdNET-Go/main.go:39 +0x174

goroutine 69 [select, 23 minutes]:
database/sql.(*DB).connectionOpener(0xc00018f380, {0x10c36e8, 0xc0002a01e0})
        /usr/local/go/src/database/sql/sql.go:1246 +0x87
created by database/sql.OpenDB in goroutine 1
        /usr/local/go/src/database/sql/sql.go:824 +0x14c

goroutine 71 [chan receive]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startDetectionProcessor.func1()
        /root/src/BirdNET-Go/internal/analysis/processor/processor.go:141 +0x55
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startDetectionProcessor in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/processor.go:139 +0x4f

goroutine 72 [chan receive, 3 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 73 [chan receive, 14 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 74 [chan receive, 10 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 75 [chan receive, 7 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 76 [chan receive, 4 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 77 [chan receive, 6 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 78 [chan receive, 5 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 79 [chan receive, 5 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 80 [chan receive, 7 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 81 [chan receive, 5 minutes]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).actionWorker(0x0?)
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:40 +0x6b
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).startWorkerPool in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/workers.go:34 +0x65

goroutine 98 [chan receive]:
github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).pendingDetectionsFlusher.func1()
        /root/src/BirdNET-Go/internal/analysis/processor/processor.go:312 +0x9c
created by github.com/tphakala/birdnet-go/internal/analysis/processor.(*Processor).pendingDetectionsFlusher in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/processor/processor.go:306 +0x4f

goroutine 99 [IO wait, 7 minutes]:
internal/poll.runtime_pollWait(0x7f9347825f10, 0x72)
        /usr/local/go/src/runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0x10?, 0xc00001bc30?, 0x0)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Accept(0xc001e4a000)
        /usr/local/go/src/internal/poll/fd_unix.go:611 +0x2ac
net.(*netFD).accept(0xc001e4a000)
        /usr/local/go/src/net/fd_unix.go:172 +0x29
net.(*TCPListener).accept(0xc000274000)
        /usr/local/go/src/net/tcpsock_posix.go:159 +0x1e
net.(*TCPListener).AcceptTCP(0xc000274000)
        /usr/local/go/src/net/tcpsock.go:314 +0x30
github.com/labstack/echo/v4.tcpKeepAliveListener.Accept({0x44ee20?})
        /go/pkg/mod/github.com/labstack/echo/v4@v4.12.0/echo.go:994 +0x17
net/http.(*Server).Serve(0xc0001fe000, {0x10c21e8, 0xc001e44010})
        /usr/local/go/src/net/http/server.go:3255 +0x33e
github.com/labstack/echo/v4.(*Echo).Start(0xc0001a4488, {0xc000450070, 0x5})
        /go/pkg/mod/github.com/labstack/echo/v4@v4.12.0/echo.go:691 +0xd2
github.com/tphakala/birdnet-go/internal/httpcontroller.New.func1()
        /root/src/BirdNET-Go/internal/httpcontroller/init.go:73 +0x1e5
created by github.com/tphakala/birdnet-go/internal/httpcontroller.New in goroutine 1
        /root/src/BirdNET-Go/internal/httpcontroller/init.go:53 +0x145

goroutine 100 [chan receive, 23 minutes]:
github.com/tphakala/birdnet-go/internal/httpcontroller.handleServerError(0xc0005163c0)
        /root/src/BirdNET-Go/internal/httpcontroller/init.go:104 +0xa5
created by github.com/tphakala/birdnet-go/internal/httpcontroller.New in goroutine 1
        /root/src/BirdNET-Go/internal/httpcontroller/init.go:82 +0x185

goroutine 101 [select]:
github.com/tphakala/birdnet-go/internal/myaudio.BufferMonitor(0x0?, 0xc0003cd220, 0xc000125da0, {0xc0003eff00, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/buffers.go:111 +0x119
created by github.com/tphakala/birdnet-go/internal/analysis.RealtimeAnalysis in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/realtime.go:123 +0x7bd

goroutine 103 [runnable]:
github.com/tphakala/birdnet-go/internal/myaudio.convert16BitToFloat32(...)
        /root/src/BirdNET-Go/internal/myaudio/process.go:90
github.com/tphakala/birdnet-go/internal/myaudio.ConvertToFloat32({0xc002368000, 0x46500, 0xc000127808?}, 0xc002368000?)
        /root/src/BirdNET-Go/internal/myaudio/process.go:77 +0x45
github.com/tphakala/birdnet-go/internal/myaudio.ProcessData(0xc0003cd220, {0xc002368000, 0x46500, 0x82000}, {0x2?, 0x1?, 0x5f98b40?}, {0xc00044a000, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/process.go:22 +0x9a
github.com/tphakala/birdnet-go/internal/myaudio.BufferMonitor(0x0?, 0xc0003cd220, 0xc000125da0, {0xc00044a000, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/buffers.go:129 +0x1ac
created by github.com/tphakala/birdnet-go/internal/analysis.RealtimeAnalysis in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/realtime.go:123 +0x7bd

goroutine 104 [runnable]:
github.com/tphakala/birdnet-go/internal/myaudio.convert16BitToFloat32(...)
        /root/src/BirdNET-Go/internal/myaudio/process.go:90
github.com/tphakala/birdnet-go/internal/myaudio.ConvertToFloat32({0xc0023ea000, 0x46500, 0xc0021fc808?}, 0xc0023ea000?)
        /root/src/BirdNET-Go/internal/myaudio/process.go:77 +0x45
github.com/tphakala/birdnet-go/internal/myaudio.ProcessData(0xc0003cd220, {0xc0023ea000, 0x46500, 0x82000}, {0x2?, 0xfa22d3901?, 0x5f98b40?}, {0xc00044a040, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/process.go:22 +0x9a
github.com/tphakala/birdnet-go/internal/myaudio.BufferMonitor(0x0?, 0xc0003cd220, 0xc000125da0, {0xc00044a040, 0x34})
        /root/src/BirdNET-Go/internal/myaudio/buffers.go:129 +0x1ac
created by github.com/tphakala/birdnet-go/internal/analysis.RealtimeAnalysis in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/realtime.go:123 +0x7bd

goroutine 130 [select, 23 minutes]:
os/exec.(*Cmd).watchCtx(0xc000206840, 0xc0005165a0)
        /usr/local/go/src/os/exec/exec.go:764 +0xb5
created by os/exec.(*Cmd).Start in goroutine 113
        /usr/local/go/src/os/exec/exec.go:750 +0x973

goroutine 106 [select, 3 minutes]:
github.com/tphakala/birdnet-go/internal/analysis.clipCleanupMonitor(0x0?, {0x0?, 0x0?}, 0xc000125da0)
        /root/src/BirdNET-Go/internal/analysis/realtime.go:221 +0x1ca
created by github.com/tphakala/birdnet-go/internal/analysis.startClipCleanupMonitor in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/realtime.go:171 +0x9b

goroutine 107 [chan receive, 23 minutes]:
github.com/tphakala/birdnet-go/internal/analysis.monitorCtrlC.func1()
        /root/src/BirdNET-Go/internal/analysis/realtime.go:194 +0x71
created by github.com/tphakala/birdnet-go/internal/analysis.monitorCtrlC in goroutine 1
        /root/src/BirdNET-Go/internal/analysis/realtime.go:190 +0x4f

goroutine 109 [syscall, 23 minutes]:
os/signal.signal_recv()
        /usr/local/go/src/runtime/sigqueue.go:152 +0x29
os/signal.loop()
        /usr/local/go/src/os/signal/signal_unix.go:23 +0x13
created by os/signal.Notify.func1.1 in goroutine 107
        /usr/local/go/src/os/signal/signal.go:151 +0x1f

goroutine 110 [select, 23 minutes]:
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP({0xc0003eff00, 0x34}, {0xc0003c1c98, 0x3}, 0x0?, 0xc000125da0, 0xc000125d40)
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:86 +0x686
created by github.com/tphakala/birdnet-go/internal/myaudio.CaptureAudio in goroutine 105
        /root/src/BirdNET-Go/internal/myaudio/capture.go:31 +0x8d

goroutine 111 [select, 23 minutes]:
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP({0xc0003eff80, 0x34}, {0xc0003c1c98, 0x3}, 0x0?, 0xc000125da0, 0xc000125d40)
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:86 +0x686
created by github.com/tphakala/birdnet-go/internal/myaudio.CaptureAudio in goroutine 105
        /root/src/BirdNET-Go/internal/myaudio/capture.go:31 +0x8d

goroutine 112 [select, 23 minutes]:
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP({0xc00044a000, 0x34}, {0xc0003c1c98, 0x3}, 0x0?, 0xc000125da0, 0xc000125d40)
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:86 +0x686
created by github.com/tphakala/birdnet-go/internal/myaudio.CaptureAudio in goroutine 105
        /root/src/BirdNET-Go/internal/myaudio/capture.go:31 +0x8d

goroutine 113 [select, 23 minutes]:
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP({0xc00044a040, 0x34}, {0xc0003c1c98, 0x3}, 0x0?, 0xc000125da0, 0xc000125d40)
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:86 +0x686
created by github.com/tphakala/birdnet-go/internal/myaudio.CaptureAudio in goroutine 105
        /root/src/BirdNET-Go/internal/myaudio/capture.go:31 +0x8d

goroutine 114 [select, 23 minutes]:
os/exec.(*Cmd).watchCtx(0xc001e8c000, 0xc001ea6060)
        /usr/local/go/src/os/exec/exec.go:764 +0xb5
created by os/exec.(*Cmd).Start in goroutine 110
        /usr/local/go/src/os/exec/exec.go:750 +0x973

goroutine 31 [select, 23 minutes]:
os/exec.(*Cmd).watchCtx(0xc0003f0000, 0xc000124120)
        /usr/local/go/src/os/exec/exec.go:764 +0xb5
created by os/exec.(*Cmd).Start in goroutine 112
        /usr/local/go/src/os/exec/exec.go:750 +0x973

goroutine 115 [syscall, 23 minutes]:
syscall.Syscall6(0xf7, 0x1, 0x12, 0xc000467e48, 0x1000004, 0x0, 0x0)
        /usr/local/go/src/syscall/syscall_linux.go:91 +0x39
os.(*Process).blockUntilWaitable(0xc001eac000)
        /usr/local/go/src/os/wait_waitid.go:32 +0x76
os.(*Process).wait(0xc001eac000)
        /usr/local/go/src/os/exec_unix.go:22 +0x25
os.(*Process).Wait(...)
        /usr/local/go/src/os/exec.go:134
os/exec.(*Cmd).Wait(0xc001e8c000)
        /usr/local/go/src/os/exec/exec.go:897 +0x45
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func1()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:47 +0x25
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 110
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:46 +0x50d

goroutine 116 [IO wait]:
internal/poll.runtime_pollWait(0x7f9347826008, 0x72)
        /usr/local/go/src/runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc001e8e060?, 0xc001eae000?, 0x1)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc001e8e060, {0xc001eae000, 0xffff, 0xffff})
        /usr/local/go/src/internal/poll/fd_unix.go:164 +0x27a
os.(*File).read(...)
        /usr/local/go/src/os/file_posix.go:29
os.(*File).Read(0xc001e98000, {0xc001eae000?, 0xc001eae000?, 0x780?})
        /usr/local/go/src/os/file.go:118 +0x52
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func2()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:67 +0x10a
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 110
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:55 +0x5fc

goroutine 32 [syscall, 23 minutes]:
syscall.Syscall6(0xf7, 0x1, 0x10, 0xc0001c3e48, 0x1000004, 0x0, 0x0)
        /usr/local/go/src/syscall/syscall_linux.go:91 +0x39
os.(*Process).blockUntilWaitable(0xc001f86000)
        /usr/local/go/src/os/wait_waitid.go:32 +0x76
os.(*Process).wait(0xc001f86000)
        /usr/local/go/src/os/exec_unix.go:22 +0x25
os.(*Process).Wait(...)
        /usr/local/go/src/os/exec.go:134
os/exec.(*Cmd).Wait(0xc0003f0000)
        /usr/local/go/src/os/exec/exec.go:897 +0x45
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func1()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:47 +0x25
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 112
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:46 +0x50d

goroutine 33 [IO wait]:
internal/poll.runtime_pollWait(0x7f93478266d0, 0x72)
        /usr/local/go/src/runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc0003bca80?, 0xc001f88000?, 0x1)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0003bca80, {0xc001f88000, 0xffff, 0xffff})
        /usr/local/go/src/internal/poll/fd_unix.go:164 +0x27a
os.(*File).read(...)
        /usr/local/go/src/os/file_posix.go:29
os.(*File).Read(0xc0000f2038, {0xc001f88000?, 0xc001f88000?, 0x780?})
        /usr/local/go/src/os/file.go:118 +0x52
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func2()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:67 +0x10a
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 112
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:55 +0x5fc

goroutine 146 [select, 23 minutes]:
os/exec.(*Cmd).watchCtx(0xc001f04000, 0xc001f14060)
        /usr/local/go/src/os/exec/exec.go:764 +0xb5
created by os/exec.(*Cmd).Start in goroutine 111
        /usr/local/go/src/os/exec/exec.go:750 +0x973

goroutine 131 [syscall, 23 minutes]:
syscall.Syscall6(0xf7, 0x1, 0xf, 0xc00046ce48, 0x1000004, 0x0, 0x0)
        /usr/local/go/src/syscall/syscall_linux.go:91 +0x39
os.(*Process).blockUntilWaitable(0xc000353380)
        /usr/local/go/src/os/wait_waitid.go:32 +0x76
os.(*Process).wait(0xc000353380)
        /usr/local/go/src/os/exec_unix.go:22 +0x25
os.(*Process).Wait(...)
        /usr/local/go/src/os/exec.go:134
os/exec.(*Cmd).Wait(0xc000206840)
        /usr/local/go/src/os/exec/exec.go:897 +0x45
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func1()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:47 +0x25
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 113
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:46 +0x50d

goroutine 132 [IO wait]:
internal/poll.runtime_pollWait(0x7f93478265d8, 0x72)
        /usr/local/go/src/runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc0002fb5c0?, 0xc002000000?, 0x1)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0002fb5c0, {0xc002000000, 0xffff, 0xffff})
        /usr/local/go/src/internal/poll/fd_unix.go:164 +0x27a
os.(*File).read(...)
        /usr/local/go/src/os/file_posix.go:29
os.(*File).Read(0xc0001aa478, {0xc002000000?, 0xc002000000?, 0x780?})
        /usr/local/go/src/os/file.go:118 +0x52
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func2()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:67 +0x10a
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 113
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:55 +0x5fc

goroutine 147 [syscall, 23 minutes]:
syscall.Syscall6(0xf7, 0x1, 0x11, 0xc001f21e48, 0x1000004, 0x0, 0x0)
        /usr/local/go/src/syscall/syscall_linux.go:91 +0x39
os.(*Process).blockUntilWaitable(0xc001f1a000)
        /usr/local/go/src/os/wait_waitid.go:32 +0x76
os.(*Process).wait(0xc001f1a000)
        /usr/local/go/src/os/exec_unix.go:22 +0x25
os.(*Process).Wait(...)
        /usr/local/go/src/os/exec.go:134
os/exec.(*Cmd).Wait(0xc001f04000)
        /usr/local/go/src/os/exec/exec.go:897 +0x45
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func1()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:47 +0x25
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 111
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:46 +0x50d

goroutine 148 [IO wait]:
internal/poll.runtime_pollWait(0x7f93478262f0, 0x72)
        /usr/local/go/src/runtime/netpoll.go:345 +0x85
internal/poll.(*pollDesc).wait(0xc001f06060?, 0xc001f24000?, 0x1)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x27
internal/poll.(*pollDesc).waitRead(...)
        /usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc001f06060, {0xc001f24000, 0xffff, 0xffff})
        /usr/local/go/src/internal/poll/fd_unix.go:164 +0x27a
os.(*File).read(...)
        /usr/local/go/src/os/file_posix.go:29
os.(*File).Read(0xc001f08000, {0xc001f24000?, 0xc001f24000?, 0x780?})
        /usr/local/go/src/os/file.go:118 +0x52
github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP.func2()
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:67 +0x10a
created by github.com/tphakala/birdnet-go/internal/myaudio.captureAudioRTSP in goroutine 111
        /root/src/BirdNET-Go/internal/myaudio/rstp.go:55 +0x5fc
tphakala commented 2 days ago

Thanks for detailed report, looks like there is some concurrency issue caused by multiple streams. I'll look into this tomorrow.

jdoss commented 2 days ago

No problem! Thanks for your quick response and for all of your hard work on this project. I am very willing to help you with any testing.

tphakala commented 1 day ago

This is now fixed by https://github.com/tphakala/birdnet-go/commit/88ea0cb6e883ac67f2332347c62d600e51accc64

jdoss commented 6 hours ago

I built a container from source and I have been running it for over 24hr four RTSPS streams without issues. I think this can be closed out. Thanks @tphakala!!

tphakala commented 6 hours ago

Currently containers in Github registry are built for every commit, so you could have just pulled new image with latest tag. However it is good that you were able to build container by youself 👍