Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat with compression enabled causes error on OS X High Sierra

We have been using Tomcat (v7) on OS X for quite some time now and never experienced any problems. However, after updating the OS to High Sierra, the web applications do not work anymore when compression is enabled in the server.xml.

Chrome constantly shows an ERR_CONTENT_DECODING_FAILED (obviously without any content displaying). When compression is switched off, everything works fine. I assume the root of the problem is Apple's upgrade of zlib in High Sierra. Everything was working fine on Sierra. The Tomcat log files look flawless -- there is no mention of any error occurring there.

Does anyone experience the same issue and managed to fix it or knows of a viable workaround without disabling compression?

Also, it would also be helpful if someone can confirm that newer versions of Tomcat do not experience this issue on High Sierra.

Thanks for your help.

like image 612
Emulov Avatar asked Oct 03 '17 07:10

Emulov


3 Answers

This is a bug in how the Java SDK setLevel() method is implemented. It is reported that compressed data resulting from setting the level is discarded by the SDK. That will result in corrupted compressed data. The fix for the bug can be found here, written by xuemingshen.

like image 154
Mark Adler Avatar answered Oct 16 '22 19:10

Mark Adler


Workaround till an actual fix is found for this: turn off compression in your tomcat project's server.xml configuration.

like image 4
cedric Avatar answered Oct 16 '22 20:10

cedric


Workarround/Hack for Windows: Unfortunately I am not familiar with OS X, but I am facing the same problem on Windows and have been able to find a little bit dirty solution for it. The deflate.c error has been fixed in 8u162-ea, see https://bugs.openjdk.java.net/browse/JDK-8189789

Unfortunately 8u162-ea may not contain all fixes or is probably not good enough for a production environment.

To fix it under 8u152, download and install the latest update from http://jdk.java.net/8/

Go to the installation folder (for instance C:\Java\jdk8-162-ea\jre\bin\) and copy the zip.dll which contains the fix (see JDK 9 deflate.c fix) and paste it on the same place under the jdk 8u152.

I hope you can find something similar under OS X.

like image 2
PF. Avatar answered Oct 16 '22 19:10

PF.