{"id":7080,"date":"2020-10-06T22:34:18","date_gmt":"2020-10-07T03:34:18","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=7080"},"modified":"2020-11-30T12:46:57","modified_gmt":"2020-11-30T17:46:57","slug":"privatetmp-strangeness-apachectl-v-s-systemctl","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=7080","title":{"rendered":"PrivateTmp Strangeness &#8212; apachectl v\/s systemctl"},"content":{"rendered":"<p>This is a very strange problem &#8212; we had a web server upgraded recently. We use &#8220;sudo apachectl start&#8221; to bring up the server since the server is maintained by a dedicated Unix support team, and the site worked fine. Until &#8230; Sunday morning after the log rotation. Then Box Spout was unable to access the XML data for an Excel file to compress it. Lots of errors:<\/p>\n<p>&nbsp;<\/p>\n<p>[Mon Sep 14 10:59:39.137728 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: ZipArchive::close(): Zlib error: stream error in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 199, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.137785 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: fopen(\/tmp\/xlsx5f5f934699dcd9.17695276.zip): failed to open stream: No such file or directory in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 213, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.137803 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: stream_copy_to_stream() expects parameter 1 to be resource, boolean given in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 214, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.137814 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 215, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.138360 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Fatal error: Uncaught exception &#8216;Box\\\\Spout\\\\Common\\\\Exception\\\\IOException&#8217; with message &#8216;Cannot perform I\/O operation outside of the base folder: \/tmp&#8217; in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Common\/Helper\/FileSystemHelper.php:130\\nStack trace:\\n#0 \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Common\/Helper\/FileSystemHelper.php(82): Box\\\\Spout\\\\Common\\\\Helper\\\\FileSystemHelper-&gt;throwIfOperationNotInBaseFolder(&#8216;\/tmp\/xlsx5f5f93&#8230;&#8217;)\\n#1 \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/XLSX\/Helper\/FileSystemHelper.php(369): Box\\\\Spout\\\\Common\\\\Helper\\\\FileSystemHelper-&gt;deleteFile(&#8216;\/tmp\/xlsx5f5f93&#8230;&#8217;)\\n#2 \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/XLSX\/Internal\/Workbook.php(134): Box\\\\Spout\\\\Writer\\\\XLSX\\\\Helper\\\\FileSystemHelper-&gt;zipRootFolderAndCopyToStream(Resource id #26)\\n#3 \/path\/to\/site\/ in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Common\/Helper\/FileSystemHelper.php on line 130, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.139468 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: ZipArchive::close(): Zlib error: stream error in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 199, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.139504 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: fopen(\/tmp\/xlsx5f5f934699dcd9.17695276.zip): failed to open stream: No such file or directory in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 213, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.139515 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: stream_copy_to_stream() expects parameter 1 to be resource, boolean given in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 214, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.139533 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/Common\/Helper\/ZipHelper.php on line 215, referer: https:\/\/hostname.example.com\/path\/to\/code.php<br \/>\n[Mon Sep 14 10:59:39.139599 2020] [:error] [pid 57117] [client 10.1.2.3:49276] PHP Fatal error: Uncaught exception &#8216;Box\\\\Spout\\\\Common\\\\Exception\\\\IOException&#8217; with message &#8216;Cannot perform I\/O operation outside of the base folder: \/tmp&#8217; in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Common\/Helper\/FileSystemHelper.php:130\\nStack trace:\\n#0 \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Common\/Helper\/FileSystemHelper.php(82): Box\\\\Spout\\\\Common\\\\Helper\\\\FileSystemHelper-&gt;throwIfOperationNotInBaseFolder(&#8216;\/tmp\/xlsx5f5f93&#8230;&#8217;)\\n#1 \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/XLSX\/Helper\/FileSystemHelper.php(369): Box\\\\Spout\\\\Common\\\\Helper\\\\FileSystemHelper-&gt;deleteFile(&#8216;\/tmp\/xlsx5f5f93&#8230;&#8217;)\\n#2 \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Writer\/XLSX\/Internal\/Workbook.php(134): Box\\\\Spout\\\\Writer\\\\XLSX\\\\Helper\\\\FileSystemHelper-&gt;zipRootFolderAndCopyToStream(Resource id #26)\\n#3 \/path\/to\/site in \/path\/to\/site\/classes\/vendor\/box\/spout\/src\/Spout\/Common\/Helper\/FileSystemHelper.php on line 130, referer: https:\/\/hostname.example.com\/path\/to\/code.php<\/p>\n<p>&nbsp;<\/p>\n<p>The postupdate script is &#8220;systemctl reload httpd.service&#8221; &#8212; so not exactly the same thing we used to launch the service originally. But I&#8217;ve never seen differing behavior between apachectl and systemctl started HTTPD instances. Quick\/dirty solution is to disable PrivateTmp, but I&#8217;m hoping to be able to isolate why exactly the postupdate script appears to break the service&#8217;s access to the private tmp space.<\/p>\n<p>30 November 2020 addendum &#8212; In discussing the issue with RedHat, they suggested using either<\/p>\n<pre>\/sbin\/killall -HUP httpd<\/pre>\n<p>or<\/p>\n<pre>\/bin\/systemctl restart httpd.service &gt; \/dev\/null 2&gt;\/dev\/null || true<\/pre>\n<p>Doing this has allowed continual access to the Private Tmp space after log rotation. Woohoo! Not sure <em>why<\/em> the default configuration that came from the Apache httpd package didn&#8217;t work (i.e. it&#8217;s not like we built some funky weird log rotation script). But success is good enough for me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a very strange problem &#8212; we had a web server upgraded recently. We use &#8220;sudo apachectl start&#8221; to bring up the server since the server is maintained by a dedicated Unix support team, and the site worked fine. Until &#8230; Sunday morning after the log rotation. Then Box Spout was unable to access &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[1122,352,1131,294,1196,1197,1144,1195],"class_list":["post-7080","post","type-post","status-publish","format-standard","hentry","category-system-administration","tag-apache-httpd","tag-httpd","tag-httpd-configuration","tag-linux","tag-log-rotataion","tag-logrotate","tag-privatetmp","tag-redhat"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7080"}],"version-history":[{"count":3,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7080\/revisions"}],"predecessor-version":[{"id":7236,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7080\/revisions\/7236"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}