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

Opt ssl read log #2451

Merged
merged 2 commits into from
Dec 3, 2023
Merged

Opt ssl read log #2451

merged 2 commits into from
Dec 3, 2023

Conversation

chenBright
Copy link
Contributor

What problem does this PR solve?

Issue Number: #977

Problem Summary:

对端发送完数据后关闭连接或者shutdown ssl,就有可能出现ssl_error=SSL_ERROR_SYSCALL/SSL_ERROR_ZERO_RETURN、nr>0、e=0,这应该是正常情况,没有必要打印WARNING日志。

What is changed and the side effects?

Changed:

Side effects:

  • Performance effects(性能影响):

  • Breaking backward compatibility(向后兼容性):


Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@Huixxi
Copy link
Contributor

Huixxi commented Nov 26, 2023

SSL_ERROR_SYSCALL 这个也要忽略么?

@chenBright
Copy link
Contributor Author

chenBright commented Nov 26, 2023

SSL_get_error文档中提到,这个场景只是读到EOF而已,不算是错误。

SSL_ERROR_SYSCALL
Some I/O error occurred. The OpenSSL error queue may contain more information on the error. If the error queue is empty (i.e. ERR_get_error() returns 0), ret can be used to find out more about the error: If ret == 0, an EOF was observed that violates the protocol. If ret == -1, the underlying BIO reported an I/O error (for socket I/O on Unix systems, consult errno for details).

@Huixxi
Copy link
Contributor

Huixxi commented Nov 26, 2023

SSL_get_error文档中提到,这个场景只是读到EOF而已,不算是错误。

SSL_ERROR_SYSCALL
Some I/O error occurred. The OpenSSL error queue may contain more information on the error. If the error queue is empty (i.e. ERR_get_error() returns 0), ret can be used to find out more about the error: If ret == 0, an EOF was observed that violates the protocol. If ret == -1, the underlying BIO reported an I/O error (for socket I/O on Unix systems, consult errno for details).

EOF只是ret==0的时候吧,ret==-1的时候该怎么判断呢?

@chenBright
Copy link
Contributor Author

chenBright commented Nov 27, 2023

加个判断吧,(ssl_error != SSL_ERROR_ZERO_RETURN && ssl_error != SSL_ERROR_SYSCALL) || nr < 0 || BIO_fd_non_fatal_error(errno) == 0,这样就能只过滤eof的日志了。

@wwbmmm
Copy link
Contributor

wwbmmm commented Nov 27, 2023

LGTM

@chenBright chenBright force-pushed the opt_ssl_log branch 2 times, most recently from 5cf6c84 to 7a685ba Compare November 28, 2023 03:09
@zyearn zyearn merged commit e6e5516 into apache:master Dec 3, 2023
18 checks passed
@chenBright chenBright deleted the opt_ssl_log branch December 4, 2023 02:16
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

Successfully merging this pull request may close these issues.

4 participants