alcemirfernandes / pynguin

Automatically exported from code.google.com/p/pynguin
GNU General Public License v3.0
0 stars 0 forks source link

ctrl+c fails to break loops, creates unexpected behavior #4

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Run the attached pynguin session (or try to implement the duopoly function 
from _Turtle Geometry_)
2.  Try to stop it while using Instant speed
3.  Note how you need to hold down ^C to interrupt it.

What is the expected output? What do you see instead?
Instaneous interruption.  Delayed interruption.

What version of the product are you using? On what operating system?
0.8, Ubuntu 9.10

Please provide any additional information below.

Original issue reported on code.google.com by aresnick...@gmail.com on 8 Jun 2010 at 11:07

Attachments:

GoogleCodeExporter commented 9 years ago
Stops instantly for me. I'm on 0.8 and Ubuntu 10.04

I will try this on 9.10 tomorrow. It may be the new PyQt makes a difference.

Try pressing ctrl-c just once and waiting. See if the event is not being seen 
or if it is taking a long time to be acted on.

Original comment by miss...@hotmail.com on 9 Jun 2010 at 1:49

GoogleCodeExporter commented 9 years ago
I tried this on Ubuntu 9.10 and it stops instantly for me there also.

There must be some difference between our systems. My suspicion is that it
is just processing speed.

Original comment by miss...@hotmail.com on 9 Jun 2010 at 7:55

GoogleCodeExporter commented 9 years ago
Interesting; I'm using an Intel Core 2 Duo P8600 2.40GHz on a Thinkpad X200 
w/4GB of RAM; you?

Original comment by aresnick...@gmail.com on 9 Jun 2010 at 9:28

GoogleCodeExporter commented 9 years ago
> Intel Core 2 Duo P8600 2.40GHz on a Thinkpad X200 w/4GB of RAM

Oh. Never mind. That can't be it.
I was going on this comment from issue 1:

>> What speed is the machine you are using?
> 1.4GHz

Have you tried this:
>> Try pressing ctrl-c just once and waiting. See if the event is not 
>> being seen or if it is taking a long time to be acted on.

Original comment by miss...@hotmail.com on 9 Jun 2010 at 10:42

GoogleCodeExporter commented 9 years ago
> Have you tried this:
>>> Try pressing ctrl-c just once and waiting. See if the event is not 
>>> being seen or if it is taking a long time to be acted on.

Yep, just tried, no joy.  Interestingly, it works with some calls to duopoly, 
and not others.  See attached for a screenshot.

It stops duopoly(4,8,2,-2) instantly, but duopoly(4,2,8,-2) took five ^C's, and 
I waited maybe 30s between each?  You can see the offset of the path in the 
attached screenshot.

Original comment by aresnick...@gmail.com on 13 Jun 2010 at 12:55

Attachments:

GoogleCodeExporter commented 9 years ago
> took five ^C's, and I waited maybe 30s between each

Ok. Seems like maybe pynguin is never receiving the ctrl-c event at all.

I'm going to make it easier to turn on debugging and put in a logger right
there where the keyboard events are coming in...

> You can see the offset of the path in the attached screenshot

Are you saying that before it stops the path changes?
Or is it that when you start it up again it is no longer on the same path?

Original comment by miss...@hotmail.com on 13 Jun 2010 at 7:45

GoogleCodeExporter commented 9 years ago
Pull the latest for a better logging setup.

Run with:

pynguin -D

for a log of each keypress. (tail -f logfile.log to watch the log).

Or run with:

pynguin -D info

for just a message for each press of ctrl-c if the other is too noisy.

You should get a log message immediately (within half a second anyhow) when the 
keys are pressed.

Original comment by miss...@hotmail.com on 13 Jun 2010 at 7:03

GoogleCodeExporter commented 9 years ago
I've just been running "python main.py" from pynguin--how should I be running 
pynguin?

Original comment by aresnick...@gmail.com on 14 Jun 2010 at 1:00

GoogleCodeExporter commented 9 years ago
Er. Sorry.

normal:
python main.py

full debug log:
python main.py -D

less verbose log:
python main.py -D info

Original comment by miss...@hotmail.com on 14 Jun 2010 at 1:08

GoogleCodeExporter commented 9 years ago
Hm; where does the log appear?

Original comment by aresnick...@gmail.com on 14 Jun 2010 at 1:13

GoogleCodeExporter commented 9 years ago
> where does the log appear?

Depends on what is in conf.py

By default:
logfile.log

Original comment by miss...@hotmail.com on 14 Jun 2010 at 1:23

GoogleCodeExporter commented 9 years ago
Huh, when I run it like that, I don't get any logfile.  My conf.py doesn't seem 
to have a logging variable:
"""

version = 'pynguin-0.8'

uidir = 'data/ui'
bug_url = 'http://code.google.com/p/pynguin/issues/list'
"""

Sorry, am I missing something?

Original comment by aresnick...@gmail.com on 15 Jun 2010 at 2:31

GoogleCodeExporter commented 9 years ago
Make sure you are running the most recent development version.

Make sure that after you do
hg pull
you then follow up with
hg update

When I first started using mercurial I sometimes forgot that 2nd step.

If you are on the most recent version and your conf.py looks like that (you 
would have had to make modifications to the file) the program should crash when 
run with the debug switch (-D)

Original comment by miss...@hotmail.com on 15 Jun 2010 at 7:54

GoogleCodeExporter commented 9 years ago
Oh, doh!  Thanks--

Here's a reproduction of the problem, with logging.

Original comment by aresnick...@gmail.com on 15 Jun 2010 at 9:02

Attachments:

GoogleCodeExporter commented 9 years ago
Well... just seeing the log file does not really help.
What do all of those "Key: ...." lines correspond to?

What happens when you press ctrl-c?

tail -f logfile.log
and watch the logfile as you are using the program (hopefully you have enough 
screen real estate that you can have pynguin over top of the log file window 
and still see the log as you are pressing ctrl-c).

Does "Ctrl-C pressed" show up as soon as you press the keys?
Or is there a delay?
Or do you sometimes press ctrl-c and it never shows up?

I find it is helpful to use "focus follows mouse" then you can mouse over the 
log window, press enter a few times to make a gap in the display of the log 
file, then mouse back to pynguin and press ctrl-c.

Original comment by miss...@hotmail.com on 15 Jun 2010 at 11:08

GoogleCodeExporter commented 9 years ago
> Well... just seeing the log file does not really help.
> What do all of those "Key: ...." lines correspond to?

Hitting backspace, moving up in the history, etc.  Getting to run the duopoly 
command

> What happens when you press ctrl-c?

In the logfile:
"""
Key: 67
Ctrl-C pressed
Thread running
"""

The penguin stops immediately, and now I have no problems with it getting 
confused in between, so it's all set!  That's great. . .thanks!

> Does "Ctrl-C pressed" show up as soon as you press the keys?

Yep!

> Or is there a delay?

Nope.

> Or do you sometimes press ctrl-c and it never shows up?

No issues with that.

Original comment by aresnick...@gmail.com on 15 Jun 2010 at 11:38

GoogleCodeExporter commented 9 years ago
>The penguin stops immediately, and now I have no problems with it 
> getting confused in between, so it's all set!

Ok. Cool.

I did have one bug that only showed up when I was not logging (I call it the 
Heisenbug) so I will leave this open for now. Please let me know if it causes 
any more trouble.

If I don't hear anything for a while, then I'll close this one out.

Thanks!

Original comment by miss...@hotmail.com on 16 Jun 2010 at 12:24

GoogleCodeExporter commented 9 years ago
Closing. Open new bug if you have any trouble.

Original comment by miss...@hotmail.com on 30 Oct 2010 at 7:10