vapor/vapor

StreamFile Crash

dnKaratzas opened this issue · 6 comments

I try to stream a file stored local on my machine. I am launching VLC given the server url, the player starts playing the file correctly but If I will change the position of the movie I got that crash.

NIOHTTP1/HTTPServerPipelineHandler.swift:115: Fatal error: Unexpectedly received a response in state sentCloseOutput
2023-05-07 10:28:50.526642+0300 App[27803:230000] NIOHTTP1/HTTPServerPipelineHandler.swift:115: Fatal error: Unexpectedly received a response in state sentCloseOutput

My route:

app.get { req async in
        let fileUrl = URL(fileURLWithPath: "....mp4")

        let res = req.fileio.streamFile(at: fileUrl.path)
        return res
}

Request:

po req
GET / HTTP/1.1
Host: 127.0.0.1:8080
Accept: */*
Accept-Language: en_US
User-Agent: VLC/3.0.18 LibVLC/3.0.18
If-Match: "1683441587.1427584-2670292847"
Range: bytes=889886732-

Response:

po res
HTTP/1.1 206 Partial Content
last-modified: Sun, 07 May 2023 06:39:47 GMT
etag: "1683441587.1427584-2670292847"
accept: bytes
content-range: bytes 889886732-2670292846/2670292847
content-type: video/mp4
content-length: 1780406115
<stream>
  • Vapor Framework version: 4.76.0
  • OS version: 13.3.1

image

image

0xTim commented

@dnKaratzas what version of SwiftNIO do you have since the crash is occurring there?

@0xTim 2.52.0

0xTim commented

@0xTim can confirm that SwiftNIO 2.51.1 causing that crash. Used SwiftNIO 2.51.0 and the crash don't occur

0xTim commented

@dnKaratzas just to confirm this isn't crashing anymore if you update your dependencies?

Tested and the issue resolved! Thanks