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

[Bug]: BETA: Streaming fails -> Error: listen EACCES: permission denied ./2.sock #262

Closed
basu-a opened this issue Oct 28, 2021 · 24 comments
Closed
Labels
bug Something isn't working

Comments

@basu-a
Copy link

basu-a commented Oct 28, 2021

What happened?

Hi,

I have been testing the EufySecurity-1.1.1-beta.2 (and have the same issue with beta.1 as well). The snapshot works fine, but whenever I try streaming, It fails with the listen EACCES error, and then restarts my home bridge with a sigterm.

I have tried the following:

reinstalling ffmpeg-for-homebridge with elevated permission (both using Docker command as well as home bridge terminal).

The first failure happens as soon as I click the camera icon on home app to steam. Logs highlight -

[10/27/2021, 10:31:15 PM] Error: listen EACCES: permission denied ./2.sock
at Server.setupListenHandle [as _listen2] (net.js:1303:21)
at listenInCluster (net.js:1368:12)
at Server.listen (net.js:1465:5)
at new NamePipeStream (/homebridge/node_modules/homebridge-eufy-security/src/accessories/UniversalStream.ts:35:21)
at StreamInput (/homebridge/node_modules/homebridge-eufy-security/src/accessories/UniversalStream.ts:44:12)
at StreamingDelegate.startStream (/homebridge/node_modules/homebridge-eufy-security/src/accessories/streamingDelegate.ts:384:41)
at processTicksAndRejections (internal/process/task_queues.js:95:5)

[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] configuration: --pkgconfigdir=/build/workspace/lib/pkgconfig --prefix=/build/workspace --pkg-config-flags=--static --extra-cflags=-I/build/workspace/include --extra-ldflags=-L/build/workspace/lib --extra-libs='-lpthread -lm' --enable-static --disable-debug --disable-shared --disable-ffplay --disable-doc --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-runtime-cpudetect --enable-libfdk-aac --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-libspeex --enable-demuxer=rtsp --enable-indev=alsa --enable-outdev=alsa
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libavutil 56. 51.100 / 56. 51.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libavcodec 58. 91.100 / 58. 91.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libavformat 58. 45.100 / 58. 45.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libavdevice 58. 10.100 / 58. 10.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libavfilter 7. 85.100 / 7. 85.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libswscale 5. 7.100 / 5. 7.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libswresample 3. 7.100 / 3. 7.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: 1223 Doorbell_video [info] libpostproc 55. 7.100 / 55. 7.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] ERROR: 1223 Doorbell_video [error] unix:./2.sock: No such file or directory
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] ERROR: 1223 Doorbell_video FFmpeg exited with code: 1 and signal: null (Error)

Full Log attached

Device Type

Doorbell (Supported)

Plugin Version

beta (Best Effort)

HomeBridge Version

v1.3.x (Supported)

NodeJS Version

v14 (Supported)

Operating System

Ubuntu

Relevant log output

[10/27/2021, 10:31:07 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Snapshot requested: 640 x 360 Front Doorbell true
[10/27/2021, 10:31:07 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Snapshot command: /homebridge/node_modules/ffmpeg-for-homebridge/ffmpeg -i https://zhixin-security-pr.s3.us-west-2.amazonaws.com/thumb/2021/10/28/LINK_GOES_HERE -frames:v 1 -f image2 - -hide_banner -loglevel error true
[10/27/2021, 10:31:07 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Fetching snapshot took 0.355 seconds. Front Doorbell true
[10/27/2021, 10:31:07 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Sending snapshot: 640 x 360 Front Doorbell true
[10/27/2021, 10:31:07 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Resize command: /homebridge/node_modules/ffmpeg-for-homebridge/ffmpeg -i pipe: -frames:v 1 -filter:v scale='min(640,iw)':'min(360,ih)':force_original_aspect_ratio=decrease -f image2 - true
[10/27/2021, 10:31:08 PM] [EufySecurity-1.1.1-beta.2] DEBUG: XYZ Eufy GET StationGuardMode: { value: 1, timestamp: 1633113715000 }
[10/27/2021, 10:31:08 PM] [EufySecurity-1.1.1-beta.2] DEBUG: XYZ Eufy GET StationCurrentMode: { value: 1, timestamp: 1635398967463 }
[10/27/2021, 10:31:08 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell GET DeviceEnabled: { value: true, timestamp: 1631756038000 }
[10/27/2021, 10:31:08 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell GET DeviceMotionDetected: { value: false, timestamp: 0 }
[10/27/2021, 10:31:08 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell GET DeviceMotionDetection: { value: true, timestamp: 1631756038000 }
[10/27/2021, 10:31:14 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Raw Property Changes: 1142 -44 1635399074735
[10/27/2021, 10:31:14 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Property Changes: wifiRssi { value: -44, timestamp: 1635399074735 }
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: ReqHK: {"sessionID":"3dbd928b-71a2-4d7d-b09e-193895c00d30","type":"start","video":{"profile":2,"level":2,"packetizationMode":0,"width":1280,"height":720,"fps":30,"pt":99,"ssrc":2554232719,"max_bit_rate":299,"rtcp_interval":0.5,"mtu":1378},"audio":{"codec":"AAC-eld","channel":1,"bit_rate":0,"sample_rate":16,"packet_time":60,"pt":110,"ssrc":3814994840,"max_bit_rate":24,"rtcp_interval":5,"comfort_pt":13,"comfortNoiseEnabled":false}}
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: ReqEufy: {"videoCodec":-1,"videoFPS":15,"videoHeight":1200,"videoWidth":1600,"audioCodec":1}
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Video stream requested: 1280 x 720, 30 fps, 299 kbps true
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] INFO:  Front Doorbell Starting video stream: 1280 x 720, 30 fps, 299 kbps (AAC-eld)
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video Stream command: /homebridge/node_modules/ffmpeg-for-homebridge/ffmpeg -use_wallclock_as_timestamps 1 -r 15 -i unix:./2.sock -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)*2:trunc(ih/2)*2 -b:v 299k -payload_type 99 -ssrc 8127836 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params OvwrowKnYv0HcHSRgz+NMXinM4MoxEzpk19ewT9S srtp://10.0.0.30:57361?rtcpport=57361&pkt_size=1316 -loglevel level+verbose -progress pipe:1
[10/27/2021, 10:31:15 PM] Error: listen EACCES: permission denied ./2.sock
    at Server.setupListenHandle [as _listen2] (net.js:1303:21)
    at listenInCluster (net.js:1368:12)
    at Server.listen (net.js:1465:5)
    at new NamePipeStream (/homebridge/node_modules/homebridge-eufy-security/src/accessories/UniversalStream.ts:35:21)
    at StreamInput (/homebridge/node_modules/homebridge-eufy-security/src/accessories/UniversalStream.ts:44:12)
    at StreamingDelegate.startStream (/homebridge/node_modules/homebridge-eufy-security/src/accessories/streamingDelegate.ts:384:41)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info] ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   configuration: --pkgconfigdir=/build/workspace/lib/pkgconfig --prefix=/build/workspace --pkg-config-flags=--static --extra-cflags=-I/build/workspace/include --extra-ldflags=-L/build/workspace/lib --extra-libs='-lpthread -lm' --enable-static --disable-debug --disable-shared --disable-ffplay --disable-doc --enable-openssl --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-runtime-cpudetect --enable-libfdk-aac --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-libspeex --enable-demuxer=rtsp --enable-indev=alsa --enable-outdev=alsa
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libavutil      56. 51.100 / 56. 51.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libavcodec     58. 91.100 / 58. 91.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libavformat    58. 45.100 / 58. 45.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libavdevice    58. 10.100 / 58. 10.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libavfilter     7. 85.100 /  7. 85.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libswscale      5.  7.100 /  5.  7.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libswresample   3.  7.100 /  3.  7.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell_video [info]   libpostproc    55.  7.100 / 55.  7.100
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] ERROR: Front Doorbell_video [error] unix:./2.sock: No such file or directory
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] ERROR: Front Doorbell_video FFmpeg exited with code: 1 and signal: null (Error)
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] INFO:  Front Doorbell Stopped video stream.
[10/27/2021, 10:31:15 PM] Got SIGTERM, shutting down Homebridge...
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Property Changes: pictureUrl {
  value: 'https://zhixin-security-pr.s3.us-west-2.amazonaws.com/thumb/MY_LINK_HERE',
  timestamp: 1635393290000
}
[10/27/2021, 10:31:15 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Raw Property Changes: 1710 {
  notification_motion_onoff: 1,
  notification_ring_onoff: 1,
  notification_style: 2
} 1631756041000
[10/27/2021, 10:31:16 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Raw Property Changes: 1142 -46 1635399076665
[10/27/2021, 10:31:16 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Property Changes: wifiRssi { value: -46, timestamp: 1635399076665 }
[10/27/2021, 10:31:18 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Raw Property Changes: 1142 -45 1635399078728
[10/27/2021, 10:31:18 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Front Doorbell Property Changes: wifiRssi { value: -45, timestamp: 1635399078728 }
[10/27/2021, 10:31:20 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[10/27/2021, 10:31:25 PM] [HB Supervisor] Restarting Homebridge...
[10/27/2021, 10:31:25 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[10/27/2021, 10:31:26 PM] [HB Supervisor] Started Homebridge v1.3.4-beta.4 with PID: 881
Initializing HAP-NodeJS v0.9.4...
[10/27/2021, 10:31:28 PM] Loaded config.json with 0 accessories and 5 platforms.
[10/27/2021, 10:31:28 PM] Loaded 16 cached accessories from cachedAccessories.
[10/27/2021, 10:31:29 PM] ---
@basu-a basu-a added the bug Something isn't working label Oct 28, 2021
@github-actions
Copy link

Did you check this Common Issues pages ?

@basu-a
Copy link
Author

basu-a commented Oct 28, 2021

Yes, but to no avail -> Tried reinstalling ffmpeg-for-homebridge via multiple methods already, but nothing worked. The stable release works fine and issue is only persistent with the beta (local streaming)

@swemoney
Copy link

swemoney commented Nov 3, 2021

I was having this save issue on the 1.1.1beta2 release while using homebridge via docker but the issue went away with a natively installed instance of homebridge.

@basu-a
Copy link
Author

basu-a commented Nov 4, 2021

Thanks for the input, @swemoney, seems like it could be something to do with the docker. The only issue I have is that I cannot run Homebridge standalone and have to rely on docker like many of the homebridge users! :)

For additional info, I can confirm that I have tried running this docker both with elevated permissions as well as user group permission mod; and both have the same issue as listed above.

@njuart
Copy link

njuart commented Nov 4, 2021

I can also confirm that in docker I constantly get No response. With native image it works, BUT when I start streaming I see stream, as soon as I stop streaming my HB restarts instantly and I see this in logs

image

@lenoxys
Copy link
Collaborator

lenoxys commented Nov 5, 2021

I know why Docker is not working.

There is NAT done between the host and the container which run the homebridge. Unfortunately, when we request local stream, the Eufy Device will stream directly by creating another UDP session with dynamic port from the Device to the HB with random port. So when Docker receive UDP packet, it can't guess on which container it need to send it, so it will discard the packet.

@schliemann
Copy link
Collaborator

schliemann commented Nov 5, 2021

Happens on my non docker setup as well.

@lenoxys
Copy link
Collaborator

lenoxys commented Nov 6, 2021

Happens on my non docker setup as well.

But it does work for few seconds ?

@steverae68
Copy link

steverae68 commented Nov 6, 2021

Hey guys, hadn’t checked in a while as was super happy with original beta with local streaming that worked great for me… this latest version… I just got no response from camera.

Using the latest 1.0.4 version works but takes a while to load image with white screen showing eufy logo.

local streaming worked great for me on original beta with this.

gapoy to provide what ever logs etc needed

can’t go back to original beta as it’s no longer available to install

** update **

Fixed it by completely uninstalling plugin, resetting HomeBridge and reinstalling only beta version.

Local streaming is now working. Still iffy resetting of homebridge after stream but live stream works now

@basu-a
Copy link
Author

basu-a commented Nov 8, 2021

Happens on my non docker setup as well.

But it does work for few seconds ?

@lenoxys any suggestions on getting it to work with docker? If you have the UDP port range, maybe I could test with opening the ports up on docker compose yml? Any ideas that I can help making this work on a docker setup?

@schliemann
Copy link
Collaborator

Still getting ECONNRESET when leaving the stream.

[17/11/2021, 12:51:16] [homebridge-eufy-security] Doorbell_video [AVIOContext @ 0x36f8480] [verbose] Statistics: 1622653 bytes read, 0 seeks
[17/11/2021, 12:51:16] Error: read ECONNRESET
at Pipe.onStreamRead (internal/stream_base_commons.js:209:20)
[17/11/2021, 12:51:16] Got SIGTERM, shutting down Homebridge...
[17/11/2021, 12:51:16] [homebridge-eufy-security] Doorbell_video FFmpeg exited with code: 0 and signal: null (Expected)

@schliemann
Copy link
Collaborator

@lenoxys I guess this happens since we ask to close the stream, when the user exits the video in the home app?

@schliemann
Copy link
Collaborator

schliemann commented Nov 17, 2021

Isn't it problematic that the sig kill waits 2 seconds to stop FFMPEG but we stop the stream in the meantime?

(

public stop(): void {
this.process.stdin.write('q' + os.EOL);
this.killTimeout = setTimeout(() => {
this.process.kill('SIGKILL');
}, 2 * 1000);
}
)

The global setTimeout() method sets a timer which executes a function or specified piece of code once the timer expires.

I assume the below means that this.platform.eufyClient.stopStationLivestream is executed prematurely?

session.mainProcess_video?.stop();
session.mainProcess_audio?.stop();
} catch (err) {
this.log.error(this.cameraName, 'Error occurred terminating main FFmpeg process: ' + err);
}
try {
this.platform.eufyClient.stopStationLivestream(this.device.getSerial());

@schliemann
Copy link
Collaborator

Well. It seems that the ffmpeg process is definitely not being terminate correctly on stop. And it is probably causing the error.

@schliemann
Copy link
Collaborator

Will take a look at this when streaming has been fixed in the client library again.

@schliemann
Copy link
Collaborator

Got an idea to try and fix the exception. Will try it out tonight.

@lenoxys
Copy link
Collaborator

lenoxys commented Jan 3, 2022

Hey found the issue. we don't handle the station livestream stop event. I've implemented it. Just checking some other thing because it don't trigger a message on the apple device

@steverae68
Copy link

steverae68 commented Jan 3, 2022 via email

@lenoxys
Copy link
Collaborator

lenoxys commented Jan 3, 2022

should be better can you test the latest beta version ?

@steverae68
Copy link

steverae68 commented Jan 3, 2022 via email

@njuart
Copy link

njuart commented Jan 3, 2022

Hey, installed latest beta8 and still HB restarts after stream stops. I see this in logs:

image

@lenoxys
Copy link
Collaborator

lenoxys commented Jan 3, 2022

Hey, installed latest beta8 and still HB restarts after stream stops. I see this in logs:

image

can you open another issue ? and fill all the informations from your environment ?

@njuart
Copy link

njuart commented Jan 3, 2022

Hey, installed latest beta8 and still HB restarts after stream stops. I see this in logs:
image

can you open another issue ? and fill all the informations from your environment ?

Sure, here you go #321

@schliemann
Copy link
Collaborator

Fixed in beta now.

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

6 participants