illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.89k stars 1.51k forks source link

Socket Closing for No Reason #640

Closed CryptAlchemy closed 1 month ago

CryptAlchemy commented 1 month ago

Hi guys! Anyone know how to resolve this? It happens on AWS ECS. It does not happen on my local Windows 11 OR on a node:20 Docker.

uncaughtException TypeError: Cannot set properties of undefined (setting 'bytesWritten')
at NodeRtmpSession.stop (/usr/src/app/node_modules/node-media-server/src/node_rtmp_session.js:221:39)
at NodeRtmpSession.onSocketClose (/usr/src/app/node_modules/node-media-server/src/node_rtmp_session.js:243:10)
at Socket.emit (node:events:518:28)
at TCP.<anonymous> (node:net:337:12)
5/4/2024 21:21:58 20 [INFO] [rtmp disconnect] id=DFNYC163
5/4/2024 21:21:45 20 [INFO] Node Media Http Server started on port: 80
5/4/2024 21:21:45 20 [INFO] Node Media WebSocket Server started on port: 80
5/4/2024 21:21:45 20 [INFO] Node Media Rtmp Server started on port: 1935
5/4/2024 21:21:45 20 [INFO] Node Media Server v2.6.6

Would really appreciate your help getting to the bottom of this!!!

CryptAlchemy commented 1 month ago

Nevermind, turns out it's because of servers in the wild running port scans on the server, opening and closing a connection.