Optimized race condition in StreamHandler when creating log directory under coroutine concurrency. - #7796
Merged
Conversation
suyar
reviewed
Aug 13, 2026
| mkdir($dir, 0777, true); | ||
| } catch (Throwable $exception) { | ||
| if (! str_contains($exception->getMessage(), 'File exists')) { | ||
| echo (string) $exception; |
Contributor
There was a problem hiding this comment.
这里为啥要直接echo?已经抛出异常了应该让全局异常捕获吧
There was a problem hiding this comment.
这里为啥要直接echo?已经抛出异常了应该让全局异常捕获吧
这里虽然报错但业务逻辑是正确的,不应该进入全局异常捕获
Contributor
There was a problem hiding this comment.
意图可能是在日志服务不可用的时候直接输出到进程stdout?
如果上下文有ob_get_contents之类的话,会把echo的内容捕获掉。当然下方有抛出异常,一般就直接宕掉了。
There was a problem hiding this comment.
意图可能是在日志服务不可用的时候直接输出到进程stdout? 如果上下文有ob_get_contents之类的话,会把echo的内容捕获掉。当然下方有抛出异常,一般就直接宕掉了。
它这里是协程竞态,文件已经创建了,所有不应该异常,不过你说得对,确实不应该echo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.