Modify

Ticket #253 (new defect)

Opened 22 months ago

Last modified 4 weeks ago

Making a quiet nan results in an infinite loop on a bifferboard

Reported by: richi@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords: nan
Cc:

Description

I want to install ros (robot operating system) on a bifferboard running debian squeeze. I had the same problem also with lenny and ros electric. The bifferboard is a small device running a 486 compatible CPU at 140 MHz. I followed the tutorial on  http://www.ros.org/wiki/fuerte/Installation/Debian and the first few steps work, but rosinstall always freezes. I can have it running for a week, and it just uses the CPU and only a small amount of memory.

Executing the following results in an infinite loop:

#rosinstall --catkin ~/ros-underlay http://ros.org/rosinstalls/fuerte-ros-base.rosinstall

When I terminate it with ctrl-c, I get the following call stack:

^CTraceback (most recent call last):
  File "/usr/local/bin/rosinstall", line 5, in <module>
    pkg_resources.run_script('rosinstall==0.6.17', 'rosinstall')
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 467, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1200, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.6/dist-packages/rosinstall-0.6.17-py2.6.egg/EGG-INFO/scripts/rosinstall", line 5, in <module>
    from rosinstall.rosinstall_cli import rosinstall_main
  File "/usr/local/lib/python2.6/dist-packages/rosinstall-0.6.17-py2.6.egg/rosinstall/rosinstall_cli.py", line 53, in <module>
    import yaml
  File "/usr/local/lib/python2.6/dist-packages/yaml/__init__.py", line 8, in <module>
    from loader import *
  File "/usr/local/lib/python2.6/dist-packages/yaml/loader.py", line 8, in <module>
    from constructor import *
  File "/usr/local/lib/python2.6/dist-packages/yaml/constructor.py", line 161, in <module>
    class SafeConstructor(BaseConstructor):
  File "/usr/local/lib/python2.6/dist-packages/yaml/constructor.py", line 257, in SafeConstructor
    inf_value *= inf_value
KeyboardInterrupt

The offending lines in /usr/local/lib/python2.6/dist-packages/yaml/constructor.py are as follows :

        inf_value = 1e300
    while inf_value != inf_value*inf_value:
        inf_value *= inf_value
    nan_value = -inf_value/inf_value   # Trying to make a quiet NaN (like C99).

Might be because the bifferboard doesn't have an FPU?  https://sites.google.com/site/bifferboard/Home/howto/qemu

some more info that might be relevant:

# cat /proc/cpuinfo 
processor	: 0
vendor_id	: CyrixInstead
cpu family	: 4
model		: 1
model name	: Cx486SLC
stepping	: unknown
fdiv_bug	: yes
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: no
fpu_exception	: no
cpuid level	: -1
wp		: yes
flags		:
bogomips	: 49.15
clflush size	: 32
power management:

# python --version
Python 2.6.7

#python
>>> inf_value = 1e300
>>> print inf_value
1e+300
>>> print inf_value*inf_value
nan
>>> print inf_value != inf_value*inf_value
True

>>> inf_value *= inf_value
>>> print inf_value
nan
>>> print inf_value*inf_value
nan
>>> print inf_value != inf_value*inf_value
True

# apt-cache show python-yaml | grep Version
Version: 3.09-5

I'm not a pythong expert, but the above results look strange to me. Executing it on my workstation, gives the results I would expect:

$ python --version
Python 2.7.3
$ python
>>> inf_value = 1e300
>>> print inf_value
1e+300
>>> print inf_value*inf_value
inf
>>> print inf_value != inf_value*inf_value
True
>>> inf_value *= inf_value
>>> print inf_value != inf_value*inf_value
False

Comparing the two, It looks like the bifferboard has no inf in addition to strangely handling nan. I don't know If python should handle that and how. But it might be good, if yaml prepared for such cpu's.

I applied a quick hack, as I don't think I'll use nan or inf on that device. I don't think that's a good solution, but it's better than an infinite loop.

    inf_value = 1e300
    loop_count = 10
    while inf_value != inf_value*inf_value and loop_count > 0:
        inf_value *= inf_value
        loop_count -= 1
    nan_value = -inf_value/inf_value   # Trying to make a quiet NaN (like C99).

Attachments

Change History

comment:1 Changed 22 months ago by richi@…

Searching the web for further information, I came across  http://bugs.python.org/issue1635 . And here is what the bifferboard prints for these instructions:

float("inf")

inf

float("-inf")

-inf

float("nan")

nan

repr(1e300 * 1e300)

'nan'

repr(1e300 * 1e300 * 0)

'nan'

repr(1e300 * 1e300 * -1)

'nan'

comment:2 Changed 12 months ago by Spearryhiphop

the potency of the actual relatively  http://www.saletomsforcheap.com - toms outlet much less the kisses regarding  http://www.saletomsforcheap.com - toms for cheap online toms on the web these people abruptly cheap  http://www.saletomsforcheap.com - toms for cheap shoes shocked along with flipped about as well as saw the actual grim face of wu ling

comment:3 Changed 11 months ago by sdfWR343Dykf

 http://louisvuittonshoes.citationguide.net Louis Vuitton Neverfull louis vuitton store in las vegas nv

comment:5 Changed 3 months ago by GeraldNut

quertontinto www.quertontinto.com  http://www.quertontinto.com - Siterszz

comment:6 Changed 4 weeks ago by Thomaskr

Спасибо админу за интересный блог.  http://domgood.com

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.