Question

I am currently developping on a Liferay server.

[liferay-portal-6.1.10-ee-ga1 + tomcat-7.0.25]

In some cases my users download files from the Document-Library.

What happens is that when they do so with the following type of url

[$LIFERAY_HOST]/c/document_library/get_file?uuid=[$OBNOXIOUSLY_LONG_UUID]&groupId=[$MY_GROUP_ID]

The file download takes ages to end.

In fact the download itself does not take more time than required. But it seems that the response is not closed.

Most download clients (including Firefox, wget, wireshark ...) don't seem to be noticed of the end of the response.

Result is that they hang for no actual good reason.

Worst is that my Firefox users have the impression that their download is taking ages for files that are really small (like 20 seconds for 8kb ... thay say, and are right, it is unacceptable).

I've tried to dig in my stacks and look around in liferay's sources but I can't figure where that latency comes from.

I've tried to look in the way of this thread (which looked really promising) https://www.liferay.com/community/forums/-/message_boards/message/11838689

But this did not apply to my problem. I've forced all filter classes to spit log messages and they all seem to execute in a few milliseconds (at most, one second all together).

I tried to inspect httpservletrequest's outputstream flushing and closing, they are all executed rightfully and cleanly ... I'm starting to loose hope and faith in myself ... I'm sad, I feel dirty, I need coffee ... Help me ... please !

---- Edit : Answer ----

In fact my problem was related to the GZip filter (in a way that I did not spot at my first tries. On my exact version rp's answer is not the actual solution but it is on a lot of close versions. If you come across the same issue, broxse either rp's Answer (down below) or this :

www.liferay.com/community/forums/-/message_boards/message/21186157#_19_message_21215343

Was it helpful?

Solution

Unfortunately, this is an issue with Liferay. Searching the Liferay bug tracker I found LPS-29323 whose description matches yours.

Fortunately the fix appears to be simple.

You can view the pull request that fixes the issue or add these lines to WEB-INF\liferay-web.xml

<filter-mapping>
    <filter-name>ETag Filter</filter-name>
    <url-pattern>^(/c/document_library/get_file|/c/message_boards/get_message_attachment|/c/wiki/get_page_attachment)(\?.*)?$</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
</filter-mapping>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top