Crash in debug mode on displaying constellation borders

Bug #951967 reported by mpopp
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Stellarium
Fix Released
Low
Alexander Miller

Bug Description

On Ubuntu 11.10, 64 bit, when starting Stellarium 0.11.2 and displaying constellation borders either by pressing B, or by going through the menu (F4 -> Markings -> Constellations -> Show Constellations), Stellarium crashes.

Graphic driver is NVIDIA 280.13 for Linux x86_64.

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

Hi,

1. Did you build from source, or use a package from a PPA?
2. Please attach your $HOME/.stellarium/log.txt file (after crash, before re-starting the program)
3. Also, please launch from a terminal window, make the crash happen, and copy-paste whatever error message appears into this post.

M

Revision history for this message
mpopp (mpopp75) wrote :
Download full text (3.5 KiB)

I installed using the builds at https://launchpad.net/~stellarium/+archive/stellarium-releases/+sourcepub/2298875/+listing-archive-extra

Stellarium's log file is attached.

Terminal window output is:

Using default graphics system specified at build time: raster
 -------------------------------------------------------
[ This is Stellarium 0.11.2 - http://www.stellarium.org ]
[ Copyright (C) 2000-2012 Fabien Chereau et al ]
 -------------------------------------------------------
Writing log file to: "/home/mpopp/.stellarium/log.txt"
File search paths:
  0 . "/home/mpopp/.stellarium"
  1 . "/usr/share/stellarium"
Config file is: "/home/mpopp/.stellarium/config.ini"
QPixmap::handle(): Pixmap is not an X11 class pixmap
OpenGL supported version: "3.3.0 NVIDIA 280.13"
Qt GL paint engine is: "OpenGL2"
Cache directory is: "/home/mpopp/.cache/stellarium/stellarium"
Sky language is "en_US"
Application language is "en_US"
Loading Solar System data ...
Loaded 64 / 64 planet orbits from "/home/mpopp/.stellarium/data/ssystem.ini"
Loading star data ...
"Loading "/usr/share/stellarium/stars/default/stars_0_0v0_1.cat": 0_0v0_1; 5013"
"Loading "/usr/share/stellarium/stars/default/stars_1_0v0_1.cat": 1_0v0_1; 21999"
"Loading "/usr/share/stellarium/stars/default/stars_2_0v0_1.cat": 2_0v0_1; 151416"
"Loading "/usr/share/stellarium/stars/default/stars_3_1v0_0.cat": 3_1v0_0; 434064"
"Loading "/home/mpopp/.stellarium/stars/default/stars_4_1v0_0.cat": 4_1v0_0; 1725497"
"Loading "/home/mpopp/.stellarium/stars/default/stars_5_2v0_0.cat": 5_2v0_0; 7669011"
"Loading "/home/mpopp/.stellarium/stars/default/stars_6_2v0_0.cat": 6_2v0_0; 26615233"
"Loading "/home/mpopp/.stellarium/stars/default/stars_7_2v0_0.cat": 7_2v0_0; 57826266"
"Loading "/home/mpopp/.stellarium/stars/default/stars_8_2v0_0.cat": 8_2v0_0; 116923084"
Finished loading star catalogue data, max_geodesic_level: 8
navigation/preset_sky_time is a double - treating as jday: 2.45151e+06
Loaded 10051 NGC records
Loading NGC name data ...
Loaded 223 / 223 NGC name records successfully
Loading star names from "/usr/share/stellarium/skycultures/western/star_names.fab"
Loaded 230 / 230 common star names
Loading star names from "/usr/share/stellarium/stars/default/name.fab"
Loaded 3215 / 4359 scientific star names
Loaded 88 / 88 constellation records successfully for culture "western"
Loaded 85 / 85 constellation art records successfully for culture "western"
Loaded 89 / 89 constellation names
Loading constellation boundary data ...
Loaded 782 constellation boundary segments
Creating GUI ...
Loaded plugin "AngleMeasure" .
AngleMeasure plugin - press control-A to toggle angle measure mode
Loaded plugin "Oculars" .
Ocular plugin - press Command-O to toggle eyepiece view mode. Press ALT-o for configuration.
Oculars::validateIniFile ocular.ini exists at: "/home/mpopp/.stellarium/modules/Oculars/ocular.ini" . Checking version...
Oculars::validateIniFile found existing ini file version 2
Loaded plugin "Satellites" .
Satellites::getJsonFileVersion() version from file: "0.7.1"
Satellites::init using satellite.json file: "/home/mpopp/.stellarium/modules...

Read more...

Revision history for this message
Alexander Wolf (alexwolf) wrote :

This is debug build, IMHO.

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

FYI: this build is a debugging build. The ASSERT error (and subsequent termination) does not happen with release builds. If you want to just use the app, you can get a release version (or build with the -DCMAKE_BUILD_TYPE=Release option to cmake).

However, the ASSERT is there for a reason, and that reason is to catch (and force developers to look at) some unexpected condition which might indicate a problem.

What projection type are you using?

Revision history for this message
mpopp (mpopp75) wrote :

My projection type is "Perspective".

Is it possible that the builds at https://launchpad.net/~stellarium/+archive/stellarium-releases (as advertised at http://www.stellarium.org/ for being release builds for Ubuntu) have been built as debug builds by accident?

I didn't see any indication that these builds should be debug builds, and I received them as updates to 0.11.1 which I don't believe were debug builds as well (and this crash didn't occur in 0.11.1).

Bogdan Marinov is listed as the person who uploaded these builds. Maybe this bug report should be brought to his attention?!

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

Ah, perspective. I never use it - only stereographic because it gives the best frame rates. Even so, I still can't replicate it. Please would you attach your $HOME/.stellarium/config.ini file, and also provide the simplest step-by step method for replicating the problem?

Thanks

M

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

I'm sure Bogdan will see this sooner or later. However, I think he's busy with other commitments at the moment. I don't know what his goals for the PPA are, but for my money I actually want users like you to trip the asserts. People like you who use PPAs and the RC downloads seem to make good bug reports, and so we have a chance to fixing things before a major release.

Revision history for this message
mpopp (mpopp75) wrote :

config.ini is attached. However, I believe I saw that even the default config.ini which is created by Stellarium upon its first start crashes this Stellarium build the same way.

The most simple way to reproduce it is: start Stellarium, and press B.

Revision history for this message
mpopp (mpopp75) wrote :

Here is an Ogg Theora video created by recordmydesktop which shows the bug in a virtual machine, running Xubuntu 12.04 on Virtualbox, also using binaries from https://launchpad.net/~stellarium/+archive/stellarium-releases/+packages

As you can see in the video, I delete the .stellarium user directory, so Stellarium really crashes with the default settings.

Revision history for this message
Matthew Gates (matthew-porpoisehead) wrote :

Hmm, even with your config.ini and using the package in question, I cannot replicate the problem. >:(

Revision history for this message
Alexander Wolf (alexwolf) wrote :

PPA building service use default value for -DCMAKE_BUILD_TYPE option and this option we set as Debug some time ago. I think Bogdan forgot about settings or PPA building service can't set this option.

Revision history for this message
mpopp (mpopp75) wrote :

It seems quite plausible that the builds were built as debug builds by accident.

summary: - Stellarium crashes when displaying constellation borders
+ Crash in debug mode on displaying constellation borders
Revision history for this message
Bogdan Marinov (daggerstab) wrote :

I've requested a new build in the "Release" configuration. It is possible that it may take several hours for the build to be completed and pushed to the software channels.

Just curious, did Ubuntu display a warning when you were installing the 0.11.2 packages? Something about them not being signed?

Revision history for this message
mpopp (mpopp75) wrote :

I didn't notice any such warning. But I didn't pay attention to it in particular, so not 100% sure.

Revision history for this message
mpopp (mpopp75) wrote :

I updated to the new builds, and the crashes went away. So this bug is resolved :).

Thank you for the quick fix!

Revision history for this message
Alexander Wolf (alexwolf) wrote :

No, this bug is hide, but yet not resolved.

Changed in stellarium:
milestone: none → 0.11.3
status: New → Confirmed
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Oops... I'm can't reproduce this bug on r5253 in debug mode. I think this bug was related with other bug (right now it closed) and I'm marked this issue as closed bug.

Changed in stellarium:
status: Confirmed → Fix Committed
importance: Undecided → Low
Changed in stellarium:
status: Fix Committed → Fix Released
Revision history for this message
Alexander Miller (alexmiller) wrote :

This bug is not fixed. I get the same error in 0.11.3 and it is still present in trunk/r5354.

Let's look what happens. «bool SphericalCap::contains(const Vec3d &) const» [src/core/StelSphereGeometry.hpp] ASSERTs with "d==0 || std::fabs(v.lengthSquared()-1.)<0.0000001". If we increase the permissible error here to 2e-7 everything works fine (the maximum error I observe is ~1.24e-7). So where does the relatively large error come from?

The points are stored in Vec3f arrays «isolatedBoundarySegments» and «sharedBoundarySegments». When drawing, «void Constellation::drawBoundaryOptim(StelPainter&) const» [src/core/modules/Constellation.cpp] converts each point's data from float to double before calling «StelPainter::drawGreatCircleArc(...)». Assuming infinite precision, the error of lengthSquared() for unit vectors rounded to single precision can be approx. 1.03e-7 [sqrt(3)/pow(2,24) + smaller term]. Thus, 1e-7 in the ASSERT may work if you are lucky, but it might break even without any further rounding errors (which we clearly have).

The additional error comes from «void StelUtils::spheToRect(float, float, Vec3f&)» [src/core/StelUtils.cpp], where the points stored in the Vec3f arrays are initially computed. If I change this function to use double precision math the maximum observed error is ~0.93e-7, i.e., it doesn't trigger the ASSERT. (As noted above, we can't really be sure, there's just no problematic vector in our data set.) This explains why you can't reproduce the error if you're using i387 math (all intermediate values are long double anyway), while x86_64 (SSE math) and other architectures using the correct precision hit the bug.

If you really want samller errors you have to convert the point arrays and all the math to double precision, but I think the following simple fix will suffice:

--- stellarium-0.11.3/src/core/StelSphereGeometry.hpp
+++ stellarium-fixed/src/core/StelSphereGeometry.hpp
@@ -297,8 +297,8 @@
  virtual SphericalCap getBoundingCap() const {return *this;}

  // Contain and intersect
- virtual bool contains(const Vec3d &v) const {Q_ASSERT(d==0 || std::fabs(v.lengthSquared()-1.)<0.0000001);return (v*n>=d);}
- virtual bool contains(const Vec3f &v) const {Q_ASSERT(d==0 || std::fabs(v.lengthSquared()-1.f)<0.000001f);return (v[0]*n[0]+v[1]*n[1]+v[2]*n[2]>=d);}
+ virtual bool contains(const Vec3d &v) const {Q_ASSERT(d==0 || std::fabs(v.lengthSquared()-1.)<0.0000002);return (v*n>=d);}
+ virtual bool contains(const Vec3f &v) const {Q_ASSERT(d==0 || std::fabs(v.lengthSquared()-1.f)<0.000002f);return (v[0]*n[0]+v[1]*n[1]+v[2]*n[2]>=d);}
  virtual bool contains(const SphericalConvexPolygon& r) const;
  virtual bool contains(const SphericalCap& h) const
  {
--- stellarium-0.11.3/src/core/StelUtils.cpp
+++ stellarium-fixed/src/core/StelUtils.cpp
@@ -334,8 +334,8 @@

 void spheToRect(float lng, float lat, Vec3f& v)
 {
- const double cosLat = cos(lat);
- v.set(cos(lng) * cosLat, sin(lng) * cosLat, sin(lat));
+ const double dlng = lng, dlat = lat, cosLat = cos(dlat);
+ v.set(cos(dlng) * cosLat, sin(dlng) * cosLat, sin(dlat));
 }

 void rectToSphe(double *lng, double *lat, const Vec3d& v)

Changed in stellarium:
status: Fix Released → In Progress
milestone: 0.11.3 → 0.11.4
assignee: nobody → Alexander Miller (alexmiller)
Revision history for this message
Alexander Wolf (alexwolf) wrote :
Changed in stellarium:
status: In Progress → Fix Committed
Changed in stellarium:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.