Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic: slice bounds out of range #26

Open
dr3amr opened this issue Jan 10, 2023 · 5 comments
Open

Panic: slice bounds out of range #26

dr3amr opened this issue Jan 10, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@dr3amr
Copy link

dr3amr commented Jan 10, 2023

Hi,

First, thanks for this, been looking for something like this to profit from embedded AI / Human detection features (instead of frigate which is cpu hog without Google Coral) outside of chinese apps / servers (I would limit internet acces to camera) and except for bellow everything works as expected.

I get bellow error few times a day and the container crashes:

panic: runtime error: slice bounds out of range [-1:]
goroutine 36 [running]:
github.com/toxuin/alarmserver/servers/hisilicon.(*Server).handleTcpConnection(0xc000184180, {0x997eb8?, 0xc00000e030})
	/tmp/app/servers/hisilicon/server.go:61 +0x805
created by github.com/toxuin/alarmserver/servers/hisilicon.(*Server).Start.func2
	/tmp/app/servers/hisilicon/server.go:126 +0x105

I have only debug:true, hisilicon and mqtt enabled. What can I do? I see there is a .handleTcpConnection method involved, which connection alarm->mqtt or camera->alarm?

@toxuin
Copy link
Owner

toxuin commented Jan 10, 2023

This is a bug, thank you for finding it! It happens when camera sends a string that is not a valid JSON and because there is not sufficient checking for such condition right now - it crashes the app, while it should just be ignored.
What camera is doing that?

@dr3amr
Copy link
Author

dr3amr commented Jan 10, 2023

I have 4x Misecu 5mp PoE cameras like bellow. Wifi is unstable but seems also PoE is unstable for these cameras. This seems like a generic camera as I saw it with different brands on Aliexpress. The video quality is good.
https://a.aliexpress.com/_EI9XKcr

@dr3amr
Copy link
Author

dr3amr commented Jan 11, 2023

@toxuin any ideea if this is hard to implement / fix?

@dr3amr
Copy link
Author

dr3amr commented Jan 25, 2023

At the moment I have setup a rule to automatically restart the container on failure thus it is almost always available and listening for "alarms" from the AI cameras. I have an automation to turn on outside lights on human detection thus the alarm server is useful, as at the moment I do not have to use Frigate which melts the CPU as I have no Coral to help.

@toxuin toxuin added the bug Something isn't working label Feb 26, 2023
@aguscaba
Copy link

aguscaba commented Mar 2, 2023

This is a bug, thank you for finding it! It happens when camera sends a string that is not a valid JSON and because there is not sufficient checking for such condition right now - it crashes the app, while it should just be ignored. What camera is doing that?

Hi @toxuin in my case the one who is sending non valid JSON stuff is the load balancer, in order to have my alarm server always up I setup a LB in front of my alarm server and created 2 of them (alarm servers) but instantally they went down :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants