winsw
winsw copied to clipboard
System.ObjectDisposedException: Cannot access a closed file.
Summary. Service Crashed without any file logging.
Steps to reproduce
SERVICE_NAME.EXE install SERVICE_NAME.EXE start next day, when i check service status via services.msc, i found out SERVICE_NAME has already stopped.
when i typed eventvwr,found the service carsh log as bellow:
Application: collect_crimp_service.exe
CoreCLR Version: 6.0.1322.58009
.NET Version: 6.0.13
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ObjectDisposedException: Cannot access a closed file.
at System.IO.FileStream.ValidateReadWriteArgs(Byte[] , Int32 , Int32 )
at System.IO.FileStream.Write(Byte[] , Int32 , Int32 )
at WinSW.StreamCopyOperation.CopyLine()
at WinSW.RollingSizeTimeLogAppender.CopyStreamWithRotation(StreamReader reader, String extension)
at WinSW.RollingSizeTimeLogAppender.<>c__DisplayClass22_0.<LogOutput>b__0()
at System.Threading.Thread.StartCallback()
<service>
<!-- 服务ID名称(唯一) -->
<id>collect_crimp</id>
<!-- 服务显示名称 -->
<name>Collect Crimp</name>
<!-- 服务的描述信息 -->
<description>挤压数据采集服务</description>
<!-- 可设置环境变量 -->
<env name="HOME" value="%BASE%"/>
<!-- 要执行的可执行文件 -->
<executable>%BASE%\collect_crimp.exe</executable>
<!-- 可执行文件传递的参数 -->
<arguments>server "%BASE%\data"</arguments>
<!-- <logmode>rotate</logmode> -->
<logpath>%BASE%\logs</logpath>
<log mode="roll-by-size-time">
<sizeThreshold>10240</sizeThreshold>
<pattern>yyyyMMdd</pattern>
<autoRollAtTime>00:00:00</autoRollAtTime>
<zipOlderThanNumDays>5</zipOlderThanNumDays>
<zipDateFormat>yyyyMMdd</zipDateFormat>
</log>
</service>
Environment
- WinSW version: 2.12.0
- WinSW package type: .NET 6.0.13
- Windows version: Microsoft Windows Server 2016 Standard 10.0.14393 暂缺 Build 14393
- Wrapped executable and version: a python binary program compiled with nuitka
To me it seems this a duplicate to https://github.com/winsw/winsw/issues/1111