Description of problem: When uploading large config files the stream reset causes a stack trace: 2016-06-30 15:33:07,478 [TP-Processor3] ERROR com.redhat.rhn.domain.config.ConfigurationFactory - IOException while reading config content from input stream! java.io.IOException: mark/reset not supported at java.io.InputStream.reset(InputStream.java:352) at com.redhat.rhn.domain.config.ConfigurationFactory.bytesFromStream(ConfigurationFactory.java:856) at com.redhat.rhn.domain.config.ConfigurationFactory.createNewContentFromStream(ConfigurationFactory.java:824) at com.redhat.rhn.manager.configuration.ConfigFileBuilder.makeNewRevision(ConfigFileBuilder.java:169) at com.redhat.rhn.manager.configuration.ConfigFileBuilder.create(ConfigFileBuilder.java:113) at com.redhat.rhn.frontend.action.configuration.BaseAddFilesAction.doCreate(BaseAddFilesAction.java:120) at com.redhat.rhn.frontend.action.configuration.BaseAddFilesAction.execute(BaseAddFilesAction.java:66) the above stacktrace occurs in ConfigurationFactory bytesFromStream stream.mark(size.intValue()); do { read = stream.read(foo, offset, (foo.length - offset)); offset += read; } while (read > 0 && offset < foo.length); stream.reset(); It looks like the following bug commit introduced this for some of the webui config uploads, bz 1091461 This issue looks fixed in spacewalk by wrapping the inputstream with a BufferedInputStream, [shughes@dhcp145-192 spacewalk{master}]$ git show c1c4a463d7c497c4b682fcb8190d372831ecf205 commit c1c4a463d7c497c4b682fcb8190d372831ecf205 Author: Bo Maryniuk <bo> Date: Tue Nov 11 12:05:36 2014 +0100 Need to wrap the InputStream in order to support mark/reset so the binary upload won't crash anymore diff --git a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java index d27d6d4..90df700 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java +++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/ConfigFileForm.java @@ -35,6 +35,7 @@ import com.redhat.rhn.manager.configuration.file.ConfigFileData; import com.redhat.rhn.manager.configuration.file.DirectoryData; import com.redhat.rhn.manager.configuration.file.SymlinkData; import com.redhat.rhn.manager.configuration.file.TextFileData; +import java.io.BufferedInputStream; import org.apache.struts.upload.FormFile; @@ -290,7 +291,7 @@ public class ConfigFileForm extends ScrubbingDynaActionForm { if (isUpload()) { FormFile file = (FormFile) get(REV_UPLOAD); try { - data = new BinaryFileData(file.getInputStream(), + data = new BinaryFileData(new BufferedInputStream(file.getInputStream()), file.getFileSize()); } catch (IOException e) { Requesting to cherry pick spacewalk c1c4a463d7c497c4b682fcb8190d372831ecf205 into Satellite 570
spacewalk.github commmits: c1c4a463d7c497c4b682fcb8190d372831ecf205 5abbdbd186896da3c5abb723e6229f6f0c103b3a
spacewalk.github: deaedf150c379dbe0bb96cbc3382f9340e7f4d5c
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2016-1645.html