Skip to content

Email add-on's mail-sending TaskExecutor may break Vaadin application startup #5703

Description

@Flaurite

Description

The Email add-on publishes its internal mail-sending pool as a Spring TaskExecutor bean (mailSendTaskExecutor in EmailConfiguration).
In a Vaadin-based Jmix application Vaadin selects a single TaskExecutor for its own asynchronous work, and a general-purpose TaskExecutor bean takes part in that selection. As a result:

  • when mailSendTaskExecutor is the only TaskExecutor in the context, Vaadin silently uses the mail-sending pool for its UI async work (unexpected contention and pool sizing);
  • when any second application- or add-on-provided TaskExecutor is present, the application fails to start.

Steps to reproduce

  1. A Jmix application with FlowUI (Vaadin 25) and the Email add-on.
  2. Add any second Spring TaskExecutor bean - e.g. a background executor from another add-on or from the application itself.
  3. Start the application.

Actual behavior

Startup fails while starting the web server:

Caused by: java.lang.IllegalStateException: Multiple TaskExecutor beans found: [app_MyBeanTaskExecutor, mailSendTaskExecutor]. Please resolve this conflict by either: (1) Providing a single TaskExecutor bean, or (2) Marking the bean to use with Vaadin by: naming it 'VaadinTaskExecutor' (e.g. @Bean("VaadinTaskExecutor")), or applying the @VaadinTaskExecutor qualifier annotation to the bean definition.
	at com.vaadin.flow.spring.SpringVaadinServletService.getExecutor(SpringVaadinServletService.java:173) ~[vaadin-spring-25.2.6.jar:na]
	at com.vaadin.flow.server.VaadinService.initSignalsEnvironment(VaadinService.java:363) ~[flow-server-25.2.6.jar:25.2.6]
	at com.vaadin.flow.server.VaadinService.init(VaadinService.java:329) ~[flow-server-25.2.6.jar:25.2.6]
	at com.vaadin.flow.spring.SpringVaadinServletService.init(SpringVaadinServletService.java:180) ~[vaadin-spring-25.2.6.jar:na]
	at com.vaadin.flow.spring.SpringServlet.createServletService(SpringServlet.java:119) ~[vaadin-spring-25.2.6.jar:na]
	at com.vaadin.flow.server.VaadinServlet.createServletService(VaadinServlet.java:342) ~[flow-server-25.2.6.jar:25.2.6]
	at com.vaadin.flow.server.VaadinServlet.init(VaadinServlet.java:134) ~[flow-server-25.2.6.jar:25.2.6]
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:832) ~[tomcat-embed-core-11.0.24.jar:11.0.24]
	... 34 common frames omitted

Even with no second executor, Vaadin quietly runs its async work on the mail-sending pool rather than a dedicated one.

Expected behavior

Adding the Email add-on should not, on its own, make Vaadin adopt the mail-sending pool, and should not cause a startup failure when the application or other add-ons define their own executors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions