deepch / RTSPtoWeb

RTSP Stream to WebBrowser
MIT License
1.32k stars 312 forks source link

fatal error: concurrent map iteration and map write #266

Open seededplyr opened 1 year ago

seededplyr commented 1 year ago

Having the following issue, seems to occur atleast once or twice a day.

Dec 27 00:33:35 archangel rtsptoweb[86967]: fatal error: concurrent map iteration and map write
Dec 27 00:33:35 archangel rtsptoweb[86967]: goroutine 504 [running]:
Dec 27 00:33:35 archangel rtsptoweb[86967]: reflect.mapiterinit(0x44cfd2?, 0x30?, 0xc4f9a0?)
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/runtime/map.go:1375 +0x19
Dec 27 00:33:35 archangel rtsptoweb[86967]: reflect.(*MapIter).Next(0xb80000?)
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/reflect/value.go:1841 +0x65
Dec 27 00:33:35 archangel rtsptoweb[86967]: internal/fmtsort.Sort({0xb80000?, 0xc000608e50?, 0xc000608e40?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/internal/fmtsort/sort.go:62 +0x1f3
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walkRange(0xc005247660, {0xbbd560?, 0xc000608e40?, 0xc000620ac0?}, 0xc000392dc0)
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:388 +0x2ec
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walk(0x0?, {0xbbd560?, 0xc000608e40?, 0xb43120?}, {0xd992e8?, 0xc000392dc0?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:277 +0x2fe
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walk(0xc005247660, {0xbbd560?, 0xc000608e40?, 0x7fa656b4e048?}, {0xd991c8?, 0xc000377050?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:274 +0x412
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walkIfOrWith(0xc005247660, 0xa, {0xbbd560?, 0xc000608e40?, 0xc0001f1db0?}, 0xc01034f260?, 0x0?, 0xc0003a7c80)
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:304 +0x1f8
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walk(0xc005247660?, {0xbbd560?, 0xc000608e40?, 0xa?}, {0xd99180?, 0xc000393640?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:271 +0x196
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walk(0xc005247660, {0xbbd560?, 0xc000608e40?, 0xc0003beb70?}, {0xd991c8?, 0xc00033c6c0?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:274 +0x412
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walkRange.func2({0xb4c420?, 0xc0001f07e0?, 0xc00c722b70?}, {0xbbd560?, 0xc000608e40?, 0xc005247380?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:373 +0x17d
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walkRange(0xc005247660, {0xba01a0?, 0xc00c722b70?, 0xb4c420?}, 0xc000393680)
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:390 +0x697
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walk(0xc005247660?, {0xba01a0?, 0xc00c722b70?, 0x0?}, {0xd992e8?, 0xc000393680?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:277 +0x2fe
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*state).walk(0xc005247660, {0xba01a0?, 0xc00c722b70?, 0xb7f340?}, {0xd991c8?, 0xc00033c000?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:274 +0x412
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*Template).execute(0xc0003928c0, {0x7fa656b4e048?, 0xc0124ed200?}, {0xba01a0?, 0xc00c722b70?})
Dec 27 00:33:35 archangel rtsptoweb[86967]:         /usr/lib/go/src/text/template/exec.go:218 +0x2c5
Dec 27 00:33:35 archangel rtsptoweb[86967]: text/template.(*Template).Execute(...)

Full debug log is too long for github, can be found here: https://pastebin.com/DauH02vw

My config is as follows

{
  "channel_defaults": {},
  "server": {
    "debug": true,
    "http_debug": false,
    "http_demo": true,
    "http_dir": "web",
    "http_login": "demo",
    "http_password": "demo",
    "http_port": ":9000",
    "https": false,
    "https_auto_tls": false,
    "https_auto_tls_name": "",
    "https_cert": "server.crt",
    "https_key": "server.key",
    "https_port": ":443",
    "ice_credential": "",
    "ice_servers": [
      "stun:stun.l.google.com:19302"
    ],
    "ice_username": "",
    "log_level": "debug",
    "rtsp_port": ":5541",
    "token": {
      "backend": "",
      "enable": false
    },
    "webrtc_port_max": 0,
    "webrtc_port_min": 0
  },
  "streams": {
    "0999b447-c370-4de4-b1f7-6cd728d5208a": {
      "channels": {
        "0": {
          "url": "rtsp://192.168.1.19:554/ch0_0.h264"
        },
        "1": {
          "url": "rtsp://192.168.1.19:554/ch0_1.h264"
        }
      },
      "name": "Indoor1"
    },
    "167e4860-a7fb-44ba-a2b7-9e9d7fa2ba21": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.25:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.25:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "West Lawn"
    },
    "318e338e-7b8b-420b-8b1e-52728d46f400": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.21:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.21:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "North Porch"
    },
    "362f6461-58d1-4411-85ee-49cfebf590d5": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.23:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.23:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "East Lawn"
    },
    "4615d292-f493-4cfc-bd70-0d42596974e9": {
      "channels": {
        "0": {
          "url": "rtsp://192.168.1.20:554/ch0_0.h264"
        },
        "1": {
          "url": "rtsp://192.168.1.20:554/ch0_1.h264"
        }
      },
      "name": "Indoor2"
    },
    "b02650bf-ce87-4a92-9cb1-f90913725ddd": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.22:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.22:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "West Porch"
    },
    "b1ad1b5e-eda5-4eba-98e4-5cef0cea6e1a": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.24:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.24:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "South Kitchen"
    },
    "c2058cfa-1dc0-4988-8c49-8410aa2a50c5": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.27:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.27:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "Porch"
    },
    "da44892a-fb2c-4f7f-a29e-5d756b2bf86a": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.28:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.28:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "West Lawn Rear"
    },
    "e27ebf89-b3b2-4fec-96ff-150772c537b4": {
      "channels": {
        "0": {
          "url": "rtsp://admin:nimda@192.168.1.26:554/cam/realmonitor?channel=1\u0026amp;subtype=0"
        },
        "1": {
          "url": "rtsp://admin:nimda@192.168.1.26:554/cam/realmonitor?channel=1\u0026amp;subtype=1"
        }
      },
      "name": "East Lawn Rear"
    }
  }
}