-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Crash occurred after reloading the config. #475
Comments
args is copied.
|
I put the api-server to sleep for 60 seconds every time it receives a connection before responding:
Start the API:
Server configuration file:
Server log displays a 30-second timeout.
Then disable http_hooks and reload:
I found that the server did not encounter any problems.
|
View the code, according to your inference, it is possible:
The condition is that if there are multiple hooks and after reloading, it executes the next on_connect args, there will be a problem. Let me reproduce it again, configure multiple hooks, and the server only time.sleep(20) without timing out. Then reload within 20 seconds to release the config:
View the logs:
It can be seen that the released config is indeed being used.
|
Therefore, whenever config is used and there is a context switch, the required data should be directly copied. For example:
|
I was thinking that I could call copy when getting this config, make a copy and then return a pointer, and then free it after using it in the function.
|
This impact is extensive, both the DVR and HLS parts, all callbacks have this issue.
|
I have already fixed it, you can refer to my submission. '
|
srs_app_rtmp_conn.cpp:
for (int i = 0; i < (int)on_connect->args.size(); i++) {
It's not just this one crash point, but they are all related to the args parameter in the authentication module's config. Every time there is a crash, the args vector does not exist anymore.
a. Authentication connection continuously times out (timeout)
b. Attempt to open the video, fail (due to authentication)
c. Disable authentication configuration (set http_hook to off)
d. Program crashes
It is inferred that after the configuration refresh, the config uses a new pointer, and the old pointer points to memory that has been released. At that time, the authentication module was using the pointer for a long time, eventually accessing non-existent data, causing a crash.
It is relatively easy to reproduce when the authentication connection definitely times out. However, it is unclear whether there is a possibility of a crash if the configuration is refreshed when authentication is successful and there is a large-scale connection access.
TRANS_BY_GPT3
The text was updated successfully, but these errors were encountered: