micronaut-projects / micronaut-views

Micronaut Integration with Server Side View Rendering
Apache License 2.0
28 stars 32 forks source link

Writable is not run on the I/O pool #758

Closed mikehearn closed 2 months ago

mikehearn commented 3 months ago

Expected Behavior

The docs say that the Writable returned by a renderer should be run on the I/O pool, but it's not and thus doing something like an HTTP fetch within it will cause a "blocking the event loop" error to be printed.

Actual Behaviour

It should be possible for view renderers to do data fetches. This hopelessly violates the Micronaut MVC paradigm of course, but ReactJS style apps that are designed to do all data fetching from the client need to be able to do the same thing when rendering on the server, and thus having the view drive the controller in server is a useful optimization.

Steps To Reproduce

  1. Write a view renderer.
  2. Do an HTTP fetch with an HttpClient inside the implementation of Writable you return.
  3. See error

Environment Information

No response

Example Application

No response

Version

master

timyates commented 3 months ago

This is due to a regression in Micronaut 4 which we are investigating

https://github.com/micronaut-projects/micronaut-core/pull/10723

I'll report back once fixed 👍

timyates commented 2 months ago

Thanks for the report @mikehearn ! 😎 👍

This is fixed in micronaut-core v4.4.4 which will be part of Micronaut 4.4.1