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

srs.librtmp is published to srs2, occasionally encountering handshake failure. #750

Closed
backylee opened this issue Jan 18, 2017 · 8 comments
Assignees
Labels
TransByAI Translated by AI/GPT.
Milestone

Comments

@backylee
Copy link

backylee commented Jan 18, 2017

OS: Centos 6.5 64-bit
SRS version srs (simple-rtmp-server) 2.0.178
srs.librtmp is released to srs, occasionally encountering handshake failure with the error message:
simple handshake failed[-1].
Restarting the program on the srs.librtmp side resolves the issue, but it reoccurs after about a day. It is not related to time, as the same code works fine on other devices.

Code:

        // connect rtmp context
        rtmphandle = srs_rtmp_create(rtmp_url);
        if (NULL == rtmphandle)
        {
            DBG("srs_rtmp_create NULL");
            uiRet = FAILURE;
            break;
        }
        DBG("srs_rtmp_create success");
        ret = srs_rtmp_handshake(rtmphandle);
        if (ret != 0)
        {
            _**DBG("simple handshake failed[%d].", ret);**_
            uiRet = FAILURE;
            break;
        }
        DBG("srs_rtmp_handshake success");

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 18, 2017

Where are the server logs? If possible, can you capture the packets using tcpdump?
Also, is it necessary to restart the program for the issue to disappear? Can retrying once solve the problem?

TRANS_BY_GPT3

@winlinvip winlinvip added this to the srs 2.0 release milestone Jan 18, 2017
@backylee
Copy link
Author

backylee commented Jan 18, 2017

The above code itself is an infinite loop attempt. It returns -1 every time. The possibility of srs.librtmp's srs_rtmp_handshake returning -1 is extremely low. I found one instance in the code: srs_librtmp_context_resolve_host calls srs_dns_resolve and returns -1 if the resolved IP address is empty. Is there a problem with DNS resolution? The probability is too low. I haven't seen any other branches that return -1.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 18, 2017

If it is a DNS issue, then the server should not have any log printing.
srslibrtmp should set an errno, or it should not return -1. It should return an errno to know various errors.
Let me first make this change.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 18, 2017

Oh, I see. The returned value is errno, and only when srs_dns_resolve fails to resolve, it will return -1. It seems that the DNS resolution has failed, so retrying won't help.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 18, 2017

I will also change this to errno, not returning -1, too ordinary...

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Jan 18, 2017

This problem is basically unsolvable, sometimes DNS resolution is problematic.
If you can use a fixed IP address, you can avoid this problem.

TRANS_BY_GPT3

@backylee
Copy link
Author

backylee commented Jan 18, 2017

When reproducing the issue next time, replace the domain name with the IP address to test if the issue is fixed. If it is fixed, it means it was a DNS problem. The return code of -1 needs to be changed.

TRANS_BY_GPT3

winlinvip added a commit that referenced this issue Jan 18, 2017
@winlinvip winlinvip self-assigned this Sep 18, 2021
@winlinvip
Copy link
Member

winlinvip commented Sep 18, 2021

srs-librtmp is no longer supported.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title srs.librtmp发布给srs2,偶尔出现握手失败 srs.librtmp is published to srs2, occasionally encountering handshake failure. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants