Download files from remote server failed but ok from localhost with FileStorage using streams

Hi Team,

Our app was working fine several months ago with both web and portal clients streams image from server. Now (Cuba studio v6.8.3) the images are shown correctly with both clients when runs locally (localhost:8080/app or app-portal), but failed when runs from remote server (even on Lan in the lab like http://192.168.1.99:8080/app or app-portal). In the remote case, with the webclient using embeddedImage component, the image is shown top part only (please see the attachment), while with the portal module, the image is not shown at all.

To isolate the problem, we build and run Cuba team’s demo project with identical environment:
GitHub - cuba-labs/portal-images: How to load and shows images from FileStorage in portal module
posted by Yuriy in July 17 at:
How to overwrite fileStorageDir? - Inaccessible primary storage - #3 от пользователя artamonov - CUBA.Platform

This demo works perfectly fine on both local and remote (Lan actually).

The key part of streaming images from the server in our code is the same as in the demo.

We observed two major differences related to the problem between our app and the demo:
1/ To organize/save uploaded files with the path string in ExtFileDescriptor, our app overrided saveStream(…) and getStorageDir(File rootDir, FileDescriptor fileDescriptor) methods of the core module:
<…>\modules\core\src\cloud\pospro\posportal\core\app\filestorage\pos\PosFileStorage.java

2/ Our app has the fileStorageDir defined as something like:
cuba.fileStorageDir=${catalina.base}/work/srnupload

The log (attached) has the same error message as in this post:

The error message is:
“java.lang.IllegalStateException: Connection not obtained from this manager”.

But we are still experiencing the problem with the fix.

Any insights and help is much appreciated.!

Attachments:
Lan_webClient_image_partialLoaded.txt (4.4 KB)
Lan_webClient_image_partialLoadedLan_portal_image_notShownAtAll.txt (26.2 KB)

1 Like

Updated the attachment files by adding portal log.

Both portal log and webClient log has the error:
java.lang.IllegalStateException: Connection not obtained from this manager

The portal log has the following two more errors that webClient log does not have:

org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer

Caused by: java.io.IOException: Connection reset by peer

Thank you,
-Mike

In the fact that Cuba demo app works just fine, we believe the problem of our app is most likely in our customization. While any insights are very welcome, please let us investigate further.

Thank you,
-Mike

The fix is to upgrade Platform version in cuba-studio from platform-6.6.2 to a newer version that has the fix from Cuba team. We upgraded to the latest platform-6.8.7.

The Cuba team’s bug track is at:
https://youtrack.cuba-platform.com/issue/PL-9458

The Cuba demo app works because it uses platform-6.5.5 which the problem had not been introduced yet.

-Mike

4 Likes