Fenrirthviti/stream-site

php 7.4

Opened this issue · 10 comments

hey again.

since migrating to php-fpm 7.4 i'm getting the following error:

2019/10/20 10:31:07 [error] 32385#32385: *2522 FastCGI sent in stderr: "PHP message: PHP Notice:  Trying to access array offset on value of type bool in /opt/www/lib/user.class.php on line 458PHP message: PHP Notice:  Trying to access array offset on value of type bool in /opt/www/lib/user.class.php on line 446" while reading response header from upstream, client: 93.123.89.46, server: node.evilbox.io, request: "GET /watch/poster=%22//node.evilbox.io/img/channel/channel_xaxo.png%22 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "node.evilbox.io", referrer: "https://node.evilbox.io/watch/xaxo"

double checked about missing modules, but not that issue. could you be so kind and let me know, what could go wrong

Looks like this error is coming up because of the query failing. I should probably have a check to validate the query completed successfully, but this error can only really occur if something went wrong on the postgres side of the house.

not sure if it's within pgsql. https://imgur.com/N2paCff

here is the exact error, when you open the player, and click play :)
postgresql 12 / php 7.4-RC-something / nginx 1.16 - php handling with FPM

any advice will be much appreciated ;) also would highly recommend the streamkey for users to be created something like user_random_uuid and look like this (for example)

user_240aa119-4b2c-496c-8b52-375a8f087e7a
  • will be easier to create folder/subfolders for users (allowing flexible storage)
  • one look and you can be sure that the token/id is working
  • won't be so frustrating for config (Xsplit / OBS / nVidia Shadowplay / Elgato's Game Capture) needed different approach to achieve connection

I'm not sure I will be able to help much any time soon though, this project is more or less on indefinite hiatus and I don't have any current plans to update my server to 7.4 to test against. According to the error itself in the nginx logs, the query is failing and returning a value that the rest of the function isn't expecting, but I can't validate if that is the case as it's not happening on my end. I would recommend going to the main config, setting debug to 1 and start adding breakpoints in the function itself where it is failing to validate each step: https://github.com/Fenrirthviti/stream-site/blob/master/lib/user.class.php#L458

The problem with that approach to stream keys is that nginx-rtmp (and http-flv by extension) doesn't allow for different ingest/playback URLs. That means anyone viewing will be able to see what your stream key is and stream as you. I would have to build some kind of custom loopback system to split out ingest from playback, which is a bit outside my current experience and skillset, so I went with the best option I could to still have some form of authentication. The current solution allows you to pass and parse URL params (which can be anything, I left it as key= for simplicity) which are not required for playback.

tried debugging but not sure why you are suggesting it, but it's already set to 1, and the database returns results as normal - https://imgur.com/a/QXlMcp2

sending mails works flawlessly - tried with my smtp server - mail delivers, the confirmation URL is valid, and enabling account is fine. what concerns me most, is that there is no reason whatsoever to get those errors. if i start playing the stream, with some media player, everything is just fine.

btw, i don't mind giving you access to my system, if you are interested to see, but the only reason i could be that i'm using openresty. if you strongly suggest to compile nginx, will do so.

overall openresty is quite handy when you need all-in-one custom libs/support.
compiling options are as follows

nginx version: openresty/1.15.8.2
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with LibreSSL 3.0.1
TLS SNI support enabled
configure arguments: --prefix=/opt/rtmp/nginx --with-cc-opt='-O2 -I/opt/rtmp/include' --add-module=../ngx_devel_kit-0.3.1rc1 --add-module=../echo-nginx-module-0.61 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.31 --add-module=../ngx_lua-0.10.15 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.7 --add-module=../rds-json-nginx-module-0.15 --add-module=../rds-csv-nginx-module-0.09 --add-module=../ngx_stream_lua-0.0.7 --with-ld-opt='-Wl,-rpath,/opt/rtmp/luajit/lib -s -Wl,-rpath,/opt/rtmp/lib:/opt/rtmp/luajit/lib -L/opt/rtmp/lib' --with-file-aio --with-ipv6 --with-md5-asm --with-pcre-jit --with-sha1-asm --with-threads --with-http_xslt_module --add-module=/src/nginx-rtmp-module-1.2.1 --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_ssl_module

Debug to 1 turns on global PHP error reporting directly in the page. If everything is working and you are only seeing this warning, set debug to 0 and see if it goes away. Debug shouldn't be left at 1 unless you're trying to diagnose an actual problem, as it makes all errors and warnings extremely verbose. The "error" itself is only a php warning message due to a change on how php7.4 handles certain edge case conditions, it's not a true error. It shouldn't be enough to halt the actual page functionality from happening. Is something not working, or is it just the warning message that has you concerned? If there is something specific that is not working properly that might help me understand where the problem might be.

yes, the problem is that the video is not playable .. https://imgur.com/a/LsUaTW2 check those 2 screenshot one is popout player

on console you can see that there is ffmpeg process, which actually is making an mp4 file.

Are you using nginx-rtmp or nginx-http-flv? If you're using rtmp, you'll need to make sure video.js is configured for rtmp playback and that flash is explicitly allowed. This will only work for the next few months, as everyone is pulling support for flash in January 2020, which is why I have most of the site migrated to nginx-http-flv.

it's compiled with both modules. where should i configure the video.js?

https://imgur.com/a/5nGJzUC

this is when the stream is on, and the player trying to show something...
i think everything comes from the player, and i'm not sure how to access the EXACT url of the current flow.
pls advice also how can i record the stream, do i need to take any actions, because the optiob for recording is .. auto...

@k1ck3r
No, you should NEVER compile nginx-rtmp along with nginx-http-flv, README writes:

nginx-http-flv-module has all features that nginx-rtmp-module provides, so DON'T compile nginx-http-flv-module along with nginx-rtmp-module.

Maybe it was the reason that your video was not playable.