Changes to threading from Micronaut 4.4 to 4.5? #10924
Replies: 9 comments 2 replies
-
no but we added blocking detection if you are blocking the event loop. As per the error message add |
Beta Was this translation helpful? Give feedback.
-
We have |
Beta Was this translation helpful? Give feedback.
-
Finally getting back to this, and I want to make sure I understand. If I want every controller method to run on BLOCKING, what is the minimum needed to make that happen? My understand was that it was sufficient to add |
Beta Was this translation helpful? Give feedback.
-
Also, is there a log I could enable to see if it's hitting the blocking operation detection you mentioned? |
Beta Was this translation helpful? Give feedback.
-
I think what's going on is I have a RolesFinder implementation which reads the roles from a database, which is a blocking operation. It worked fine with 4.4 but with 4.6 something is interrupting the thread. |
Beta Was this translation helpful? Give feedback.
-
Ok, I think I finally figured out what's going on. At least, I figured out a key difference between 4.4 and 4.6. In 4.4, it uses I'm not really sure what's interrupting the thread in my case, but obvious it's not ideal to run blocking operations in the event loop. Can we get NimbusReactiveJsonWebTokenValidator to use a scheduler? Or at least give us the option to use a scheduler? On a side note, in 4.6 both For example, TokenAuthenticationValidator iterates over the tokenValidators then picks the first one. That may not always be the reactive one. |
Beta Was this translation helpful? Give feedback.
-
@sdelamo since micronaut-projects/micronaut-security#1693 was your PR, I figured you might like to know about this finding. Both the fact that Let me know if you want me to write up bug(s) for these |
Beta Was this translation helpful? Give feedback.
-
I just realized why this would cause my thread to be interrupted--
So, both token validators actually get called (because of In my case it's causing side effects because the RolesFinder implementation also calls Redis which has it's own threading, and that is also getting interupted, throwing exceptions. So, I think the fix for my problem is to provide some mechanism to ensure that JwtTokenValidator and NimbusReactiveJsonWebTokenValidator don't both run at the same time, or at least order |
Beta Was this translation helpful? Give feedback.
-
I went ahead and wrote them both up |
Beta Was this translation helpful? Give feedback.
-
We're in the process of upgrading to Micronaut 4.x from Micronaut 3.10. We had everything working in 4.4.3 but before we finished testing, 4.5.0 came out. So we tried upgrading to that and we started getting all kinds of strange behavior. We had 3 microservices upgraded and saw 3 completely different behaviors, but all of them failing where they worked fine in 4.4. Is there anything you can think of that would explain this?
One of the services started throwing:
Another started throwing
The only thing that seems to be in common is that threads are involved. Was there any change to threading?
Beta Was this translation helpful? Give feedback.
All reactions