admin管理员组文章数量:1024630
So the Micronaut docs tell us that Micronaut uses an event loop:
Micronaut framework is built on Netty which is designed around an Event loop model and non-blocking I/O. Micronaut executes code defined in @Controller beans in the same thread as the request thread (an Event Loop thread).
And further says
To use the
blocking
executor, simply mark e.g. a controller withExecuteOn
I'm looking for reasons that the given annotations might not work. I've tried both
@ExecuteOn(TaskExecutors.BLOCKING)
or
@ExecuteOn(TaskExecutors.IO)
but the thread used is still one of default-nioEventLoopGroup-2-3
, etc
I have a blocking operation to execute, and it is failing with the error
io.micronaut.http.client.exceptions.HttpClientException: You are trying to run a BlockingHttpClient operation on a netty event loop thread. This is a common cause for bugs: Event loops should never be blocked. You can either mark your controller as @ExecuteOn(TaskExecutors.BLOCKING), or use the reactive HTTP client to resolve this bug. There is also a configuration option to disable this check if you are certain a blocking operation is fine here.
Alternatively, if anyone knows where/what that last mentioned "configuration option` is to disable the check, that would also be useful.
So the Micronaut docs tell us that Micronaut uses an event loop:
Micronaut framework is built on Netty which is designed around an Event loop model and non-blocking I/O. Micronaut executes code defined in @Controller beans in the same thread as the request thread (an Event Loop thread).
And further says
To use the
blocking
executor, simply mark e.g. a controller withExecuteOn
I'm looking for reasons that the given annotations might not work. I've tried both
@ExecuteOn(TaskExecutors.BLOCKING)
or
@ExecuteOn(TaskExecutors.IO)
but the thread used is still one of default-nioEventLoopGroup-2-3
, etc
I have a blocking operation to execute, and it is failing with the error
io.micronaut.http.client.exceptions.HttpClientException: You are trying to run a BlockingHttpClient operation on a netty event loop thread. This is a common cause for bugs: Event loops should never be blocked. You can either mark your controller as @ExecuteOn(TaskExecutors.BLOCKING), or use the reactive HTTP client to resolve this bug. There is also a configuration option to disable this check if you are certain a blocking operation is fine here.
Alternatively, if anyone knows where/what that last mentioned "configuration option` is to disable the check, that would also be useful.
Share Improve this question asked Nov 18, 2024 at 15:51 StewartStewart 18.3k8 gold badges56 silver badges84 bronze badges1 Answer
Reset to default 2happens to me as well. It turned out it is because I am using suspend function such as
@ExecuteOn(TaskExecutors.BLOCKING)
suspend fun greet(): String
So the Micronaut docs tell us that Micronaut uses an event loop:
Micronaut framework is built on Netty which is designed around an Event loop model and non-blocking I/O. Micronaut executes code defined in @Controller beans in the same thread as the request thread (an Event Loop thread).
And further says
To use the
blocking
executor, simply mark e.g. a controller withExecuteOn
I'm looking for reasons that the given annotations might not work. I've tried both
@ExecuteOn(TaskExecutors.BLOCKING)
or
@ExecuteOn(TaskExecutors.IO)
but the thread used is still one of default-nioEventLoopGroup-2-3
, etc
I have a blocking operation to execute, and it is failing with the error
io.micronaut.http.client.exceptions.HttpClientException: You are trying to run a BlockingHttpClient operation on a netty event loop thread. This is a common cause for bugs: Event loops should never be blocked. You can either mark your controller as @ExecuteOn(TaskExecutors.BLOCKING), or use the reactive HTTP client to resolve this bug. There is also a configuration option to disable this check if you are certain a blocking operation is fine here.
Alternatively, if anyone knows where/what that last mentioned "configuration option` is to disable the check, that would also be useful.
So the Micronaut docs tell us that Micronaut uses an event loop:
Micronaut framework is built on Netty which is designed around an Event loop model and non-blocking I/O. Micronaut executes code defined in @Controller beans in the same thread as the request thread (an Event Loop thread).
And further says
To use the
blocking
executor, simply mark e.g. a controller withExecuteOn
I'm looking for reasons that the given annotations might not work. I've tried both
@ExecuteOn(TaskExecutors.BLOCKING)
or
@ExecuteOn(TaskExecutors.IO)
but the thread used is still one of default-nioEventLoopGroup-2-3
, etc
I have a blocking operation to execute, and it is failing with the error
io.micronaut.http.client.exceptions.HttpClientException: You are trying to run a BlockingHttpClient operation on a netty event loop thread. This is a common cause for bugs: Event loops should never be blocked. You can either mark your controller as @ExecuteOn(TaskExecutors.BLOCKING), or use the reactive HTTP client to resolve this bug. There is also a configuration option to disable this check if you are certain a blocking operation is fine here.
Alternatively, if anyone knows where/what that last mentioned "configuration option` is to disable the check, that would also be useful.
Share Improve this question asked Nov 18, 2024 at 15:51 StewartStewart 18.3k8 gold badges56 silver badges84 bronze badges1 Answer
Reset to default 2happens to me as well. It turned out it is because I am using suspend function such as
@ExecuteOn(TaskExecutors.BLOCKING)
suspend fun greet(): String
本文标签: configurationMicronaut Event Loop vs ExecuteOn(TaskExecutorsBLOCKING)Stack Overflow
版权声明:本文标题:configuration - Micronaut Event Loop vs @ExecuteOn(TaskExecutors.BLOCKING) - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745610124a2158954.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论