COM port ReadFile() blocks indefinitly in WINE 10, works correctly in 7.16

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Post Reply
Jhawx
Newbie
Newbie
Posts: 2
Joined: Tue May 27, 2025 5:39 am

COM port ReadFile() blocks indefinitly in WINE 10, works correctly in 7.16

Post by Jhawx »

Hi,
I’m encountering a serious regression when working with a real serial port (e.g., /dev/ttyS0) in Wine 10.0 that did not exist in Wine 7.16.

In Wine 7.16, my Windows application opens COM1 (mapped to /dev/ttyS0) and uses ReadFile() with an OVERLAPPED structure. Even when no data is immediately available, the call returns quickly — either with 0 bytes or via APC.

In Wine 10.0, the same application hangs indefinitely on ReadFile(). Looking at +server,+comm,+file,+tid logs:
• Wine enters a select() with timeout=infinite and status=PENDING
• Signal SIGUSR1 is sent (*sent signal* appears), but the operation does not complete
• The process stays stuck in a loop of select()/APC_ASYNC_IO/PENDING until the physical device sends data
• Eventually, when data is received, select() returns status=0 and total=30, and the app resumes

Same COM settings in both cases: 115200 8N1, no flow control.
Tested with real /dev/ttyS0 device (RS232 adapter), mapped to com1.

This change breaks responsiveness and UI interaction — the app freezes for several seconds at startup if the device is not talking.

Is this a known behavioral change in how Wine handles serial port I/O or APC?
Can I revert this behavior without patching and rebuilding Wine?

Thanks in advance!
Jhawx
Newbie
Newbie
Posts: 2
Joined: Tue May 27, 2025 5:39 am

Re: COM port ReadFile() blocks indefinitly in WINE 10, works correctly in 7.16

Post by Jhawx »

wine 10.0

Code: Select all

register_async( type=1, async={handle=02bc,event=02b4,iosb=0134a644,user=7d532e90,apc=00000000,apc_context=0134a644}, count=1000 )
[15:08:46] 0024: register_async() = PENDING
[15:08:46] 0024: *sent signal* SIGUSR1
[15:08:46] 0024: select( flags=2, cookie=7ffcdb14, timeout=0, size=0, prev_apc=0000, result={}, data={}, contexts={{machine=i386,eip=7bcfc83c,esp=0031f730,ebp=0031f780,eflags=00000246,cs=0023,ss=002b,ds=002b,es=002b,fs=0063,gs=006b,eax=000000a5,ebx=0134a644,ecx=00000000,edx=00000000,esi=0031f7b4,edi=000002bc,ymm0=0,ymm1=0,ymm2=0,ymm3=0,ymm4=0,ymm5=0,ymm6=0,ymm7=0,ymm8=0,ymm9=0,ymm10=0,ymm11=0,ymm12=0,ymm13=0,ymm14=0,ymm15=0,exec_space=syscall}} )
[15:08:46] 0024: select() = KERNEL_APC { apc_handle=02c0, signaled=1, call={APC_ASYNC_IO,user=7d532e90,sb=0134a644,status=ALERTED,result=0}, contexts={} }
[15:08:46] 0024: select( flags=2, cookie=7ffcdb14, timeout=0, size=0, prev_apc=02c0, result={APC_ASYNC_IO,status=PENDING,total=0}, data={}, contexts={} )
[15:08:46] 0024: select() = TIMEOUT { apc_handle=0000, signaled=1, call={}, contexts={} }
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=0000, result={}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = PENDING { apc_handle=0000, signaled=0, call={}, contexts={} }
[15:08:46] 0024: *wakeup* signaled=256
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=0000, result={}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = KERNEL_APC { apc_handle=02c0, signaled=1, call={APC_ASYNC_IO,user=7d532e90,sb=0134a644,status=ALERTED,result=0}, contexts={} }
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=02c0, result={APC_ASYNC_IO,status=PENDING,total=0}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = PENDING { apc_handle=0000, signaled=0, call={}, contexts={} }
[15:08:46] 0024: *wakeup* signaled=256
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=0000, result={APC_ASYNC_IO,status=PENDING,total=0}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = KERNEL_APC { apc_handle=02c0, signaled=1, call={APC_ASYNC_IO,user=7d532e90,sb=0134a644,status=ALERTED,result=0}, contexts={} }
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=02c0, result={APC_ASYNC_IO,status=PENDING,total=0}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = PENDING { apc_handle=0000, signaled=0, call={}, contexts={} }
[15:08:46] 0024: *wakeup* signaled=256
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=0000, result={APC_ASYNC_IO,status=PENDING,total=0}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = KERNEL_APC { apc_handle=02c0, signaled=1, call={APC_ASYNC_IO,user=7d532e90,sb=0134a644,status=TIMEOUT,result=0}, contexts={} }
[15:08:46] 0024: select( flags=2, cookie=0021ebb4, timeout=infinite, size=8, prev_apc=02c0, result={APC_ASYNC_IO,status=0,total=30}, data={WAIT,handles={02b4}}, contexts={} )
[15:08:46] 0024: select() = 0 { apc_handle=0000, signaled=1, call={}, contexts={} }
Post Reply