JMIX 1.x app NOT working on AWS - Communication error: Invalid JSON from server: 1|X

I get the error all the time.

Communication error: Invalid JSON from server: 1|X

It is not regular, but after few minutes it will come.
The problem is while editing a form… Users lose their data.

This ia like a nightmare… after several month of development, deploying the app to AWS, users get these errors…

I never got this error in DEV/TEST on localhost,… only on in AWS cloud.

Please help…
Thank you.

JMIX 1.5.5
AWS EC2 Linux 2023, single instance behind Application loadbalancer.

UI:

Communication problem
Pay attention to any unsaved data, and click here to continue.
Invalid JSON from server: 1|X

WebDeveloper Tools Console in Edge:

vaadinPush.js?v=8.14.3-4-jmix:1 Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). - wasClean: false
log @ vaadinPush.js?v=8.14.3-4-jmix:1
warn @ vaadinPush.js?v=8.14.3-4-jmix:1
ax.onclose @ vaadinPush.js?v=8.14.3-4-jmix:1

image

Other posts:

I increased the time out on Application LoadBalancer in AWS EC2 to 6 minutes.
It looks much better.
For example 15 minutes without any error… before impossible.

But the error is there from time to time…

So I guess Loadbalancer is not the cause or not the only cause … ?

So maybe Atmosphere or the reverse proxy on EC2 instance.

:confounded:

Loadbalancer timeout is useless…

It is not a timeout issue.
Sometimes it happens during active work in a web form while the browser actively communicates with backend.

I checked Loadbalancer logs… nothing.
I checked nginx reverse proxy on EC2 instance… nothing.

The only thing I keep getting is: When browser stuck, log shows:

HTTP 101
...
X-Atmosphere-Transport=close
...

Like this:

[29/Feb/2024:12:37:52 +0000] "GET /vaadinServlet/PUSH?v-uiId=3&v-pushId=3f8f32e3-1795-4d8f-a141-3020d2519755&X-Atmosphere-tracking-id=5ce24b82-51e5-4d3b-b9e5-c7088d71c303&X-Atmosphere-Framework=2.3.2.vaadin2-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true HTTP/1.1" 101 31 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0" "86.49.252.98"
[29/Feb/2024:12:37:57 +0000] "GET /vaadinServlet/PUSH?v-uiId=3&v-pushId=3f8f32e3-1795-4d8f-a141-3020d2519755&X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=5ce24b82-51e5-4d3b-b9e5-c7088d71c303&_=1709210277631 HTTP/1.1" 200 0 "https://visaesp.cz-visit.eu/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0" "86.49.252.98"
[29/Feb/2024:12:37:57 +0000] "GET /vaadinServlet/PUSH?v-uiId=3&v-pushId=3f8f32e3-1795-4d8f-a141-3020d2519755&X-Atmosphere-tracking-id=5ce24b82-51e5-4d3b-b9e5-c7088d71c303&X-Atmosphere-Framework=2.3.2.vaadin2-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json;%20charset=UTF-8&X-atmo-protocol=true HTTP/1.1" 101 44 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:122.0) Gecko/20100101 Firefox/122.0" "86.49.252.98"

I there any Atmosphere expert out there?
Thank you… @krivopustov @mbucan

Hello Tomas,

I’m afraid I can’t help with this except to give advice.

  1. Use Haulmont consulting services, they are excellent and I used it when I was stuck, it cost some money but given your situation it may be warranted - atm they are all busy with the February Jmix release and will be for some time, so I doubt they can find time to deal with the complex issue on the forum topic for now - by using the consultancy service you prioritize your issue

  2. Do like I did - no uberjar
    When I have encountered the problem, I also found all those threads but this one was the most useful
    Communication Problem - Pay attention to any unsaved data etc. Invalid JSON from server: 1/x - #11 by klaus - CUBA.Platform
    Check out what Michael Why wrote.
    So from all that, I learned that:

  • when using AWS Elastic, you get their ALB (application load balancer), which has NGINX in the background, but it doesn’t like Jetty
  • you can’t finely configure the nginx in the ALB because it’s provided by AWS infrastructure without giving you access to it
    → so I installed a Tomcat web server and deployed as war to the EC2 instance - giving up, for now, to use Elastic with their load balancer
    → I plan to convert this app from CUBA to Jmix 2.2 and then use a docker image, and I will build image to have Tomcat, and then put it on AWS, hopefully, Elastic Container Service

Kind regards,
Mladen

OK. Thank you.

One quick note, I think there is Tomcat.

This is TRACE of Atmoshere:

org.apache.tomcat.websocket.WsSession@53d69002 closed CloseReason: code [1000],

Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: 2024-03-02 21:46:46.724 TRACE 1051010 --- [io-5000-exec-10] org.atmosphere.container.JSR356Endpoint  : org.apache.tomcat.websocket.WsSession@53d69002 closed CloseReason: code [1000], reason [null]
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: 2024-03-02 21:46:46.724 TRACE 1051010 --- [io-5000-exec-10] o.a.websocket.DefaultWebSocketProcessor  : About to close AtmosphereResource for AtmosphereResource{
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 uuid=23ff04c1-093d-465a-804b-6a4d20b8c69c,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 transport=WEBSOCKET,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 isInScope=false,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 isResumed=false,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 isCancelled=true,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 isSuspended=false,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 broadcasters=/*,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 isClosedByClient=true,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 isClosedByApplication=false,
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: #011 action=Action{timeout=-1, type=CANCELLED}} with code 1000
Mar  2 21:46:46 ip-172-31-29-207 web[1051010]: 2024-03-02 21:46:46.724 TRACE 1051010 --- [io-5000-exec-10] o.a.websocket.DefaultWebSocketProcessor  : Unable to properly complete 23ff04c1-093d-465a-804b-6a4d20b8c69c


UPDATE:

Pattern is like this:

  1. Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). - wasClean: false vaadinPush.js:1:40443

  2. Atmosphere: Firing onReopen 2 vaadinPush.js:1:40443

  3. Atmosphere: Closing (AtmosphereRequest._close() called) vaadinPush.js:1:40443

  4. Atmosphere: invoking .close() on WebSocket object vaadinPush.js:1:40443

  5. Atmosphere: Request already closed, not firing onClose (unsubscribe case) vaadinPush.js:1:40443

  6. Atmosphere: websocket.onclose vaadinPush.js:1:40443

  7. Websocket closed, reason: Normal closure; the connection successfully completed whatever purpose for which it was created. - wasClean: true vaadinPush.js:1:40443

  8. Vaadin freees.

  9. JMix freezes.

  10. Game over.

Client side, FireFox Atmosphere detailed debug log, nothing more than:

Connection was closed abnormally (that is, with no close frame being sent). - wasClean: false

10:59:41.961 q.logLevel='debug';
10:59:41.973 "debug"
10:59:51.389 Thu Mar 07 2024 10:59:51 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onclose vaadinPush.js:1:40443
10:59:51.389 Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). - wasClean: false vaadinPush.js:1:40443
10:59:51.389 Thu Mar 07 2024 10:59:51 GMT+0100 (Central European Standard Time) Atmosphere: Firing onClose (closed case) vaadinPush.js:1:40443
10:59:51.390 Thu Mar 07 2024 10:59:51 GMT+0100 (Central European Standard Time) Atmosphere: Request already closed, not firing onClose (closed case) vaadinPush.js:1:40443
10:59:51.390 Thu Mar 07 2024 10:59:51 GMT+0100 (Central European Standard Time) Atmosphere: invoking .close() on WebSocket object vaadinPush.js:1:40443
10:59:51.390 Thu Mar 07 2024 10:59:51 GMT+0100 (Central European Standard Time) Atmosphere: Firing onReconnect 2 vaadinPush.js:1:40443
10:59:56.394 Invoking executeWebSocket, using URL: wss://xxxx.xxxxx.eu/vaadinServlet/PUSH?v-uiId=0&v-pushId=9e4d3270-f605-479c-995b-7bf55ef8f317&X-Atmosphere-tracking-id=88023ec5-a77c-49cc-a648-01ea6786ad01&X-Atmosphere-Framework=2.3.2.vaadin2-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json; charset=UTF-8&X-atmo-protocol=true vaadinPush.js:1:40443
10:59:56.527 Thu Mar 07 2024 10:59:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onopen vaadinPush.js:1:40443
10:59:56.528 Websocket successfully opened vaadinPush.js:1:40443
10:59:56.528 Thu Mar 07 2024 10:59:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
10:59:56.528 Thu Mar 07 2024 10:59:56 GMT+0100 (Central European Standard Time) Atmosphere: Firing onReopen 2 vaadinPush.js:1:40443
11:00:56.610 Thu Mar 07 2024 11:00:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:01:56.616 Thu Mar 07 2024 11:01:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:02:50.979 initMouseEvent() is deprecated. Use the MouseEvent() constructor instead. line 9 > injectedScript:1:13050
11:02:56.623 Thu Mar 07 2024 11:02:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:03:56.531 Thu Mar 07 2024 11:03:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:04:56.530 Thu Mar 07 2024 11:04:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:05:56.530 Thu Mar 07 2024 11:05:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:06:56.549 Thu Mar 07 2024 11:06:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:07:56.529 Thu Mar 07 2024 11:07:56 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onclose vaadinPush.js:1:40443
11:07:56.530 Websocket closed, reason: Connection was closed abnormally (that is, with no close frame being sent). - wasClean: false vaadinPush.js:1:40443
11:07:56.530 Thu Mar 07 2024 11:07:56 GMT+0100 (Central European Standard Time) Atmosphere: Firing onClose (closed case) vaadinPush.js:1:40443
11:07:56.530 Thu Mar 07 2024 11:07:56 GMT+0100 (Central European Standard Time) Atmosphere: Request already closed, not firing onClose (closed case) vaadinPush.js:1:40443
11:07:56.530 Thu Mar 07 2024 11:07:56 GMT+0100 (Central European Standard Time) Atmosphere: invoking .close() on WebSocket object vaadinPush.js:1:40443
11:07:56.530 Thu Mar 07 2024 11:07:56 GMT+0100 (Central European Standard Time) Atmosphere: Firing onReconnect 2 vaadinPush.js:1:40443
11:08:01.534 Invoking executeWebSocket, using URL: wss://xxxx.xxxxx.eu/vaadinServlet/PUSH?v-uiId=0&v-pushId=9e4d3270-f605-479c-995b-7bf55ef8f317&X-Atmosphere-tracking-id=88023ec5-a77c-49cc-a648-01ea6786ad01&X-Atmosphere-Framework=2.3.2.vaadin2-javascript&X-Atmosphere-Transport=websocket&X-Atmosphere-TrackMessageSize=true&Content-Type=application/json; charset=UTF-8&X-atmo-protocol=true vaadinPush.js:1:40443
11:08:01.681 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onopen vaadinPush.js:1:40443
11:08:01.681 Websocket successfully opened vaadinPush.js:1:40443
11:08:01.681 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:08:01.681 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Firing onReopen 2 vaadinPush.js:1:40443
11:08:01.682 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onmessage vaadinPush.js:1:40443
11:08:01.682 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Firing onMessage vaadinPush.js:1:40443
11:08:01.685 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Closing (AtmosphereRequest._close() called) vaadinPush.js:1:40443
11:08:01.685 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Firing onClose (unsubscribe case) vaadinPush.js:1:40443
11:08:01.685 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Request already closed, not firing onClose (unsubscribe case) vaadinPush.js:1:40443
11:08:01.685 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help https://xhr.spec.whatwg.org/#sync-warning vaadinPush.js:1:26045
11:08:01.790 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: ajaxRequest.onreadystatechange, new state: 4 vaadinPush.js:1:40443
11:08:01.791 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: onreadystatechange has been ignored due to _abortingConnection flag vaadinPush.js:1:40443
11:08:01.791 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: invoking .close() on WebSocket object vaadinPush.js:1:40443
11:08:01.791 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Request already closed, not firing onClose (unsubscribe case) vaadinPush.js:1:40443
11:08:01.821 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: websocket.onclose vaadinPush.js:1:40443
11:08:01.821 Websocket closed, reason: Normal closure; the connection successfully completed whatever purpose for which it was created. - wasClean: true vaadinPush.js:1:40443
11:08:01.821 Thu Mar 07 2024 11:08:01 GMT+0100 (Central European Standard Time) Atmosphere: Request already closed, not firing onClose (closed case) 2 vaadinPush.js:1:40443
11:08:01.821 Websocket closed normally vaadinPush.js:1:40443

I tested the app in the environment without AWS Elastic Load Balancer and without HTTPS.
It is the same.
I got the error several times:

Communication error: Invalid JSON from server: 1|X

So IMHO the main suspect is the NGINX reverse proxy at EC2 AL2023 instance which is forwarding 80 to 5000 port.

Any idea pleas?
Thanks.
Tomas

Hi Tomas,
Do you have these settings on NGINX?

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Default config looks like this:

image

image

Hi,

According to Vaadin forum topics with similar problem, as an option, you can try to change Push transport from websocket to long-polling. To do this:

  1. Create a custom AppUI class
@Push(transport = Transport.LONG_POLLING)
public class CustomAppUI extends AppUI {
}
  1. Register this bean
@Bean
public AppUI customAppUI() {
    return new CustomAppUI();
}
  1. Exclude built-in AppUI class in application.properties:
jmix.core.exclude-beans = appUI

Regards,
Gleb

@gorelov Dear Gleb,
thank you very much for this suggestion.
And yes I am able to switch to LONG POLLING:

2024-03-17 23:54:35.830 TRACE 71664 --- [nio-8080-exec-1] o.a.c.DefaultAtmosphereResourceFactory   : Adding: AtmosphereResource{
	 uuid=04d3481c-e839-4441-8986-af86ecb9401c,
	 transport=LONG_POLLING,
	 isInScope=true,
	 isResumed=false,
	 isCancelled=false,
	 isSuspended=true,
	 broadcasters=/*,
	 isClosedByClient=false,
	 isClosedByApplication=false,
	 action=Action{timeout=-1, type=SUSPEND}}

Interesting is that, I got a lot of these error (it is INFO level actually):

2024-03-17 23:49:25.977  INFO 71664 --- [nio-8080-exec-2] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:26.994  INFO 71664 --- [nio-8080-exec-4] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:29.014  INFO 71664 --- [nio-8080-exec-7] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2024-03-17 23:49:31.018  INFO 71664 --- [io-8080-exec-10] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:32.021  INFO 71664 --- [nio-8080-exec-2] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:36.036  INFO 71664 --- [nio-8080-exec-7] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:37.047  INFO 71664 --- [nio-8080-exec-9] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:41.049  INFO 71664 --- [nio-8080-exec-4] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:42.061  INFO 71664 --- [nio-8080-exec-6] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:46.069  INFO 71664 --- [nio-8080-exec-1] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:47.078  INFO 71664 --- [nio-8080-exec-3] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:51.081  INFO 71664 --- [nio-8080-exec-8] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:52.094  INFO 71664 --- [io-8080-exec-10] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:56.098  INFO 71664 --- [nio-8080-exec-5] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:49:57.111  INFO 71664 --- [nio-8080-exec-7] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:50:01.113  INFO 71664 --- [nio-8080-exec-2] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:50:02.149  INFO 71664 --- [nio-8080-exec-4] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:50:06.134  INFO 71664 --- [nio-8080-exec-9] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:50:07.171  INFO 71664 --- [nio-8080-exec-1] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.
2024-03-17 23:50:11.145  INFO 71664 --- [nio-8080-exec-6] com.vaadin.server.VaadinServlet          : Requested resource [/VAADIN/push] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

BUT this error is suspicious:

IllegalStateException: Session has already been set.

2024-03-17 23:55:02.306 ERROR 71664 --- [nio-8080-exec-9] com.vaadin.server.DefaultErrorHandler    : 

java.lang.IllegalStateException: Session has already been set. Old session: com.vaadin.server.VaadinSession@62bc9424 for jmixVaadinServlet. New session: com.vaadin.server.VaadinSession@16549935 for jmixVaadinServlet.
	at com.vaadin.ui.UI.setSession(UI.java:502) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:189) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]

I will try it on AWS…

Thank you.
Regards
Tomas

OK, changing the ApUI bean is the way to hell…

After start start of the app:

2024-03-19 10:51:00.217 ERROR 69968 --- [nio-8080-exec-6] com.vaadin.server.DefaultErrorHandler    : 
java.lang.IllegalStateException: Session has already been set. Old session: com.vaadin.server.VaadinSession@40113ab6 for jmixVaadinServlet. New session: com.vaadin.server.VaadinSession@755c7445 for jmixVaadinServlet.
	at com.vaadin.ui.UI.setSession(UI.java:502) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:189) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:67) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar:4.0.1]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209) ~[tomcat-embed-core-9.0.83.jar:9.0.83]

2024-03-19 10:51:00.220 ERROR 69968 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[jmixVaadinServlet]    : Servlet.service() for servlet [jmixVaadinServlet] threw exception
java.lang.IllegalStateException: Session has already been set. Old session: com.vaadin.server.VaadinSession@40113ab6 for jmixVaadinServlet. New session: com.vaadin.server.VaadinSession@755c7445 for jmixVaadinServlet.
	at com.vaadin.ui.UI.setSession(UI.java:502) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:189) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:67) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar:4.0.1]

2024-03-19 10:51:00.231 ERROR 69968 --- [nio-8080-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [com.vaadin.server.ServiceException: java.lang.IllegalStateException: Session has already been set. Old session: com.vaadin.server.VaadinSession@40113ab6 for jmixVaadinServlet. New session: com.vaadin.server.VaadinSession@755c7445 for jmixVaadinServlet.] with root cause
java.lang.IllegalStateException: Session has already been set. Old session: com.vaadin.server.VaadinSession@40113ab6 for jmixVaadinServlet. New session: com.vaadin.server.VaadinSession@755c7445 for jmixVaadinServlet.
	at com.vaadin.ui.UI.setSession(UI.java:502) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:189) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:67) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465) ~[vaadin-server-8.14.3-4-jmix.jar:8.14.3-4-jmix]
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:750) ~[javax.servlet-api-4.0.1.jar:4.0.1]

The App works. Just log has these errors.

The real pain is after logout.
If you click the Logout link, the app end s in deadend loop.

Mar 19 15:37:12 ip-172-31-14-147 web[5978]: 2024-03-19 15:37:12.579 ERROR 5978 --- [nio-5000-exec-7] io.jmix.ui.AppUI                         : Error handling exception
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: Original exception:
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: java.lang.IllegalStateException: This UI instance is already initialized (as UI id 0) and can therefore not be initialized again (as UI id 2). Please make sure you are not accidentally reusing an old UI instance.
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at com.vaadin.ui.UI.doInit(UI.java:730)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at com.vaadin.server.communication.UIInitHandler.getBrowserDetailsUI(UIInitHandler.java:209)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:67)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1636)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:465)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at javax.servlet.http.HttpServlet.service(HttpServlet.java:750)
Mar 19 15:37:12 ip-172-31-14-147 web[5978]: #011at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:209)

Mar 19 15:38:22 ip-172-31-14-147 web[5978]: 2024-03-19 15:38:22.349 ERROR 5978 --- [nio-5000-exec-5] io.jmix.ui.AppUI                         : Error handling exception
Mar 19 15:38:22 ip-172-31-14-147 web[5978]: Original exception:
Mar 19 15:38:22 ip-172-31-14-147 web[5978]: java.lang.IllegalStateException: This UI instance is already initialized (as UI id 0) and can therefore not be initialized again (as UI id 3). Please make sure you are not accidentally reusing an old UI instance.


Mar 19 15:38:22 ip-172-31-14-147 web[5978]: Exception in handlers:
Mar 19 15:38:22 ip-172-31-14-147 web[5978]: java.lang.IllegalStateException: No App is bound to the current VaadinSession


It is impossible to reload and login agaian. Only server restart helps.

:roll_eyes:

No difference.
This “AppUI customAppUI()” does not work.
IllegalStateException: Session has already been set. Old session:…

@tomas.klems - could you prepare a simplest test application and deployment instructions to reproduce the problem?
Also, if possible, please test this example application with the Quick Cloud Deployment (it uses Apache HTTP Server as a reverse proxy).

Dear @krivopustov, here is the update:

  1. The problem is the same with Jmix 2.2, not only 1.5
  2. Sample project attached, but there is nothing special. It works on local. On AWS it fails randomly.
  3. The project are deployed here and you an experience the problem yourself (just wait for it).

http://awstestone.eu-central-1.elasticbeanstalk.com/?debug
http://awstesttwo.eu-central-1.elasticbeanstalk.com/

I will keep them here for few days to let you test…

There is one more news: In JMix 2.2, there is HTTP 403 after websocket 101 “error”.

Thank you.

PS: as I wrote before, it is

  1. AWS Elastic Beanstalk Java PaaS, Corretto 11 resp. 17, 64bit, Amazon Linux 2023, Postgres DB, t4g.small.
  2. Single instance, no balancer, no firewall, no ssl.
  3. There is standard EC2 instance NGINX proxy 80:5000

Regards,
Tomas.

image

image

In JMix 2.2 there are also ERRORs in the server log:

After logout:

Mar 26 22:32:52 ip-172-31-30-39 web[28045]: 2024-03-26T22:32:52.920Z ERROR 28045 --- [sphere-Shared-1] c.v.f.s.c.PushAtmosphereHandler          : Exception in push connection
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: java.io.IOException: Connection remotely closed for 867aaffc-74f6-4ff8-9398-224b9597e376
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.websocket.WebSocket.write(WebSocket.java:237) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.websocket.WebSocket.write(WebSocket.java:227) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.websocket.WebSocket.write(WebSocket.java:48) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.cpr.AtmosphereResponseImpl$Stream.write(AtmosphereResponseImpl.java:955) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:154) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at com.vaadin.flow.server.communication.PushAtmosphereHandler.onStateChange(PushAtmosphereHandler.java:54) ~[flow-server-24.3.3.jar!/:24.3.3]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1036) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1056) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:870) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at org.atmosphere.cpr.DefaultBroadcaster$2.run(DefaultBroadcaster.java:477) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[na:na]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
Mar 26 22:32:52 ip-172-31-30-39 web[28045]: #011at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]

And this error:

Mar 26 22:51:16 ip-172-31-30-39 web[41299]: 2024-03-26T22:51:16.179Z DEBUG 41299 --- [io-5000-exec-10] o.a.websocket.DefaultWebSocketProcessor  : Delaying closing operation for firefox and resource 8294ef86-9ddb-4959-9111-bd3384ba4e0f
Mar 26 22:51:48 ip-172-31-30-39 web[41299]: 2024-03-26T22:51:48.440Z DEBUG 41299 --- [nio-5000-exec-7] o.a.websocket.DefaultWebSocketProcessor  : Delaying closing operation for firefox and resource 8294ef86-9ddb-4959-9111-bd3384ba4e0f
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: 2024-03-26T22:52:40.471Z DEBUG 41299 --- [nio-5000-exec-5] o.a.websocket.DefaultWebSocketProcessor  : Delaying closing operation for firefox and resource f6f0246f-2677-4f07-8163-fa1a101542a6
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: 2024-03-26T22:52:40.501Z ERROR 41299 --- [sphere-Shared-0] c.v.f.s.c.PushAtmosphereHandler          : Exception in push connection
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: java.io.IOException: Connection remotely closed for f6f0246f-2677-4f07-8163-fa1a101542a6
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.websocket.WebSocket.write(WebSocket.java:237) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.websocket.WebSocket.write(WebSocket.java:227) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.websocket.WebSocket.write(WebSocket.java:48) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.cpr.AtmosphereResponseImpl$Stream.write(AtmosphereResponseImpl.java:955) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.handler.AbstractReflectorAtmosphereHandler.onStateChange(AbstractReflectorAtmosphereHandler.java:154) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at com.vaadin.flow.server.communication.PushAtmosphereHandler.onStateChange(PushAtmosphereHandler.java:54) ~[flow-server-24.3.3.jar!/:24.3.3]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.cpr.DefaultBroadcaster.invokeOnStateChange(DefaultBroadcaster.java:1036) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.cpr.DefaultBroadcaster.prepareInvokeOnStateChange(DefaultBroadcaster.java:1056) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.cpr.DefaultBroadcaster.executeAsyncWrite(DefaultBroadcaster.java:870) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at org.atmosphere.cpr.DefaultBroadcaster$2.run(DefaultBroadcaster.java:477) ~[atmosphere-runtime-3.0.3.slf4jvaadin2.jar!/:3.0.3.slf4jvaadin2]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[na:na]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
Mar 26 22:52:40 ip-172-31-30-39 web[41299]: #011at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: 2024-03-26T22:53:41.045Z DEBUG 41299 --- [nio-5000-exec-4] o.atmosphere.container.JSR356Endpoint    : Problem in web socket session
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: java.io.EOFException: null
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1296) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1184) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:74) ~[tomcat-embed-websocket-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:184) ~[tomcat-embed-websocket-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:164) ~[tomcat-embed-websocket-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:152) ~[tomcat-embed-websocket-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:57) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-embed-core-10.1.18.jar!/:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: #011at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Mar 26 22:53:41 ip-172-31-30-39 web[41299]: 2024-03-26T22:53:41.046Z DEBUG 41299 --- [nio-5000-exec-4] o.a.websocket.DefaultWebSocketProcessor  : Delaying closing operation for firefox and resource f7acc60b-f0ce-4717-9895-324fea322814

The error is much more frequent in AWSTestOne than in AwsTestTwo.
So I guess something is better in JMix 2.2. … the new VAADIN, newer Atmosphere,…etc.

So I also had this problem and I also did a lot of investigation and trial and error.

For the application load balancer I use a HTTP client keep alive duration: 3600 seconds. Very long I know. Somehow it seems to help. Also a Connection idle timeout: 900 seconds.

For the nginx proxy configuration I use the following:

            proxy_connect_timeout 600s;
            proxy_read_timeout  900s;
            proxy_send_timeout  900s;

            proxy_set_header    Connection          $connection_upgrade;
            proxy_set_header    Upgrade             $http_upgrade;
            proxy_set_header    Host                $host;
            proxy_set_header    X-Real-IP           $remote_addr;
            proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
            proxy_redirect      off;

I didn’t run into this problem now for quite some time, so it looks like this helps. Also I use newest Jmix (almost) 2.1.3