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

Gets stuck at gnutls_handshake() #311

Open
alex-lt-kong opened this issue Feb 4, 2023 · 0 comments
Open

Gets stuck at gnutls_handshake() #311

alex-lt-kong opened this issue Feb 4, 2023 · 0 comments

Comments

@alex-lt-kong
Copy link

alex-lt-kong commented Feb 4, 2023

I am using Debian 11 (testing) with gnutls installed by apt install gnutls-dev. Note that previously I use Debian 10 (stable), I upgrade to Debian testing only because I would like to try newer version of gnutls.

My Onion instance will get stuck after running for a few days (i.e., it does not respond to any incoming connections). I investigated it for a while and it turns out to be the issue of gnutls_handshake():

onion/src/onion/https.c

Lines 222 to 225 in de8ea93

int ret;
do {
ret = gnutls_handshake(session);
} while (ret < 0 && gnutls_error_is_fatal(ret) == 0);

I revised the above section to:

do{
	ONION_DEBUG("gnutls_handshake()'ing\n");
	ret = gnutls_handshake (session);
	ONION_DEBUG("gnutls_handshake()'ed, ret=%d, strerror=%s\n", ret,gnutls_strerror (ret));
	// https://gnutls.org/reference/gnutls-gnutls.html#gnutls-handshake
}while (ret < 0 && gnutls_error_is_fatal (ret) == 0);
ONION_DEBUG("gnutls_handshake() loop out\n");

and build onion with cmake -DCMAKE_BUILD_TYPE=Debug ../. The below is what I get from log after my instance gets stuck:

[45376E00] [2023-02-04 09:36:56] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

[45376E00] [2023-02-04 09:36:56] [DEBUG https.c:226] gnutls_handshake()'ing

[45376E00] [2023-02-04 09:42:07] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

[45376E00] [2023-02-04 09:42:07] [DEBUG https.c:226] gnutls_handshake()'ing

[45376E00] [2023-02-04 09:47:18] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

[45376E00] [2023-02-04 09:47:18] [DEBUG https.c:226] gnutls_handshake()'ing

[45376E00] [2023-02-04 09:52:30] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

[45376E00] [2023-02-04 09:52:30] [DEBUG https.c:226] gnutls_handshake()'ing

[45376E00] [2023-02-04 09:57:41] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

[45376E00] [2023-02-04 09:57:41] [DEBUG https.c:226] gnutls_handshake()'ing

[45376E00] [2023-02-04 10:02:52] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

[45376E00] [2023-02-04 10:02:52] [DEBUG https.c:226] gnutls_handshake()'ing

[45376E00] [2023-02-04 10:08:04] [DEBUG https.c:228] gnutls_handshake()'ed, ret=-28, strerror=Resource temporarily unavailable, try again.

I am also aware that gnutls's doc on gnutls-handshake() does say that "[o]n these non-fatal errors call this function again, until it returns 0" so I am not sure if this is something Onion can fix.

I am now trying the following, see if it can "solve" the issue (could take weeks to get result):

do{
	ONION_DEBUG("gnutls_handshake()'ing\n");
	ret = gnutls_handshake (session);
	ONION_DEBUG("gnutls_handshake()'ed, ret=%d, strerror=%s\n", ret,gnutls_strerror (ret));
	if (ret == -28) {
		break;
	}
	// https://gnutls.org/reference/gnutls-gnutls.html#gnutls-handshake
}while (ret < 0 && gnutls_error_is_fatal (ret) == 0);

Any idea on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant