[issue26744] print() function hangs on MS-Windows 10

2017-03-09 Thread Eryk Sun

Eryk Sun added the comment:

> After enabling `QuickEdit Mode`, then click the console will 
> suspend the program.

That's not suspending the entire process. It's blocking the thread that writes 
to the console. The user-mode WriteConsole function is implemented by a 
synchronous NtDeviceIoControlFile system call. The console (i.e. conhost.exe) 
is on the other end of the call. It has at least 2 threads -- an input thread 
that's basically a standard message loop and an output thread for updating and 
rendering the contents of its active screen buffer. It's a feature that 
clicking on the console window to copy text causes its output thread to block. 
This in turn prevents WriteFile in python.exe from completing.

That said, I've seen random hangs in the console that are unrelated to the 
above (e.g. hanging while reflowing text), but not often enough that I bothered 
to investigate it. There's a lot of new code in the 2nd generation console 
implementation (ConhostV2.dll) in Windows 10, and the developers are making 
significant improvements with each update. I'm waiting for the dust to settle.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2017-03-09 Thread Ma Lin

Ma Lin added the comment:

This is an invalid issue, very sorry for waste your time! Especially apologize 
to Stinner.

After enabling `QuickEdit Mode`, then click the console will suspend the 
program.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-17 Thread Ma Lin

Ma Lin added the comment:

faulthandler module caught a hang just now:

Timeout (0:01:00)!
Thread 0x0eb0 (most recent call first):
  File "D:\git\tz2txt\tz2txt\gui.py", line 262 in delfile
  File "C:\Python35\lib\tkinter\__init__.py", line 1549 in __call__
  File "C:\Python35\lib\tkinter\__init__.py", line 1131 in mainloop
  File "D:\git\tz2txt\tz2txt\gui.py", line 328 in main
  File "D:\git\tz2txt\tz2txt\gui.py", line 331 in 
  
 Here is the full delfile function:
  
  def delfile(self):
try:
output = self.output.get().strip()
os.remove(output)
except:
pass
else:
print('已删除输出文件')# <- line 262

try:
os.remove(discard_fn)
except:
pass
else:
print('已删除丢弃文件')

self.url.set(url_use)

~~
Some supplemental information:

There was a time point, *maybe* it's Windows10 Threshold2 (12/Nov/2015), before 
that time no hang at all.
After that time, the hangs were quite often.
Some months later, the frequency had declined a lot, but still hang 
occasionally.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-15 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

I'm afraid not. If run it 1000 times, only about <5 times occurs, the others 
are quite fine.
I have installed faulthandler, let's wait the hunting.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> In addition, the printed strings are Simplified Chinese, my system's language 
> is it as well. Maybe it's a factor?

Ooh yes. The Windows Console sucks to display Unicode: see the very old 
issue #1602 which is not fixed yet and is 9 years old...

Try to replace your chinese message with a simple ASCII text like print("test") 
to check if it works around your issue.

Maybe IDLE and/or PowerShell have a better Unicode support, I don't know for 
Chinese.

Sorry, I know better Linux, I know that Linux handles well Unicode in terminals.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

>> It looks like a bug in your application. Can you provide a short script to 
>> reproduce the bug?

It's hard to believe it, the code has no way to behavior like that.
I think this is not reproducible, it's random hang.

As my subjective feelings, I suspect it's a Windows bug.

e.g., after an relative long time nooperation, I suddenly press a button in 
tkinter GUI, it simply delete a file like this:

try:
output = self.output.get().strip()
os.remove(output)
except:
pass
else:
print('已删除输出文件')

It usually hangs at the print() line.

Another scene is high IO, I download something at 8 MB/s, then I run my 
program, it should download a HTML page and then print() some information, some 
hangs happed in this scene.

In addition, the printed strings are Simplified Chinese, my system's language 
is it as well. Maybe it's a factor?

I'm inclined to guess is a Windows 10 (or only my system's) bug.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> To be honest, I'm a bit suprise that almost no one complain it, maybe it's my 
> system's fault? I don't know.

It looks like a bug in your application. Can you provide a short script to 
reproduce the bug?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

ok, I will try faulthandler module.

>> Are you running your program in the Windows console (cmd.exe)? In IDLE? In 
>> PowerShell?

One runs in pure command line mode, cmd.exe.
The other is a simple tkinter GUI with a console for output message.

To be honest, I'm a bit suprise that almost no one complain it, maybe it's my 
system's fault? I don't know.

Just want to remind you try ENTER key next time.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread STINNER Victor

STINNER Victor added the comment:

> I have two programs, they occasionally infinite hang.

Can you please try the faulthandler module to try to get a traceback of all 
Python threads?

I suggest to use the watchdog with a short timeout (ex: 60 seconds):
https://docs.python.org/dev/library/faulthandler.html#faulthandler.dump_traceback_later

> 1, print() function cause the infinite hang.
> 2, If it hangs, simply press ENTER key, it goes on without any problem.

Are you running your program in the Windows console (cmd.exe)? In IDLE? In 
PowerShell?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-13 Thread Ma Lin

Ma Lin added the comment:

After my MS-Windows 10 updated to 10586.218 this day, it occurs again.

It hung, the console cursor was flashing at the beginning of the current line.
I pressed ENTER key on the console window, then it printed the supposed content 
and went on.

I have read issue26624, if you encounter the issue again, try ENTER key, if it 
works maybe it's the same problem.

--
components: +Interpreter Core
nosy: +eryksun, haypo, jkloth

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26744] print() function hangs on MS-Windows 10

2016-04-12 Thread Ma Lin

New submission from Ma Lin:

My OS is MS-Windows 10 X86-64 (Home edition), with the lastest update (now it's 
10586.164).

I have two programs, they occasionally infinite hang.
After a few months observation, I provide these infomation:

1, print() function cause the infinite hang.
2, If it hangs, simply press ENTER key, it goes on without any problem.
3, Both pure-console program and console in Tkinter program have this issue.
4, I tried offical Python 3.4.4 64bit and 3.5.1 64bit, they all have this 
issue. I didn't try other versions because my programs need Python 3.4+.
5, IIRC, the problem was since Windows 10 Threshold 2 (12/Nov/2015), but I'm 
not very sure about this.

--
components: Windows
messages: 263295
nosy: Ma Lin, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: print() function hangs on MS-Windows 10
versions: Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com