gosmore crashes after a few searches

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

gosmore crashes after a few searches

Petter Reinholdtsen

I never got a clear answer about where to send bug reports and patches
related to gosmore, so I try to send them here.

The gosmore program was accepted into the Debian archive a few days
ago, and already got 10 registered users.  One of them report of a
segfault in gosmore after a few searches.  Check out
<URL:http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=gosmore> for the
details.

Is this a known bug?  How can I fix it?

Happy hacking,
--
Petter Reinholdtsen
One of the Debian gosmore package maintainers

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Martijn van Oosterhout-2
On 8/29/07, Petter Reinholdtsen <[hidden email]> wrote:
> The gosmore program was accepted into the Debian archive a few days
> ago, and already got 10 registered users.  One of them report of a
> segfault in gosmore after a few searches.  Check out
> <URL:http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=gosmore> for the
> details.

Looks like memory corruption. I'd say run it under some memory
checking program  (like valigrind) and see how it fares. Memory
corruption generally causes the program to die far away from the
actual error :(

Ask the bug reporter, but if you use the program yourself you can do
it also. It slows the program a bit, but with a bit of perserverence
you can hopefully get results.

Have a nice day,
--
Martijn van Oosterhout <[hidden email]> http://svana.org/kleptog/

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Tom Hughes-3
In reply to this post by Petter Reinholdtsen
In message <[hidden email]>
        Petter Reinholdtsen <[hidden email]> wrote:

> I never got a clear answer about where to send bug reports and patches
> related to gosmore, so I try to send them here.

I can create a trac component for it if that's helpful - I just need
to know who the reports should go to.

Tom

--
Tom Hughes ([hidden email])
http://www.compton.nu/

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Petter Reinholdtsen
In reply to this post by Martijn van Oosterhout-2

[Martijn van Oosterhout]
> Looks like memory corruption. I'd say run it under some memory
> checking program (like valigrind) and see how it fares. Memory
> corruption generally causes the program to die far away from the
> actual error :(

Yeah, valgrind is very nice.

Are anyone here able to reproduce the problem?  I am not.  I tried
with and without valgrind myself.  From valgrind I only saw errors
related to uninitialized bytes for memory allocated within gtk
functions (Xlib related).

> Ask the bug reporter, but if you use the program yourself you can do
> it also. It slows the program a bit, but with a bit of perserverence
> you can hopefully get results.

Will do. :)

Happy hacking,
--
Petter Reinholdtsen


_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Petter Reinholdtsen
In reply to this post by Martijn van Oosterhout-2

[Martijn van Oosterhout]
> Ask the bug reporter, but if you use the program yourself you can do
> it also. It slows the program a bit, but with a bit of perserverence
> you can hopefully get results.

Now the valgrind output is available from
<URL:http://bugs.debian.org/439732>, and gosmore seem to write past
allocated memory, and I suspect that mess seriously with the control
structure used by malloc() and friends.

I am unable to reproduce this problem myself, so I do not know what
more to provide to help debugging the problem.

Happy hacking,
--
Petter Reinholdtsen


_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Tom Hughes-3
In message <[hidden email]>
        Petter Reinholdtsen <[hidden email]> wrote:

> [Martijn van Oosterhout]
>> Ask the bug reporter, but if you use the program yourself you can do
>> it also. It slows the program a bit, but with a bit of perserverence
>> you can hopefully get results.
>
> Now the valgrind output is available from
> <URL:http://bugs.debian.org/439732>, and gosmore seem to write past
> allocated memory, and I suspect that mess seriously with the control
> structure used by malloc() and friends.

Looks like it has overrun a text field in the GUI by one byte.

Unfortunately the gosmore has been stripped so valgrind wasn't
able to identify the routine in gosmore that was responsible.

Does Debian have debuginfo packages like RedHat/Fedora that can
be installed to let valgrind get the symbols?

Tom

--
Tom Hughes ([hidden email])
http://www.compton.nu/

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Martijn van Oosterhout-2
In reply to this post by Petter Reinholdtsen
On 8/30/07, Petter Reinholdtsen <[hidden email]> wrote:

>
> [Martijn van Oosterhout]
> > Ask the bug reporter, but if you use the program yourself you can do
> > it also. It slows the program a bit, but with a bit of perserverence
> > you can hopefully get results.
>
> Now the valgrind output is available from
> <URL:http://bugs.debian.org/439732>, and gosmore seem to write past
> allocated memory, and I suspect that mess seriously with the control
> structure used by malloc() and friends.

Ugh, looks like the gosmore binary has been stripped, so there's no
debugging information. The output is full of lines like:

==22233==    by 0x804BB45: (within /usr/bin/gosmore)
==22233==    by 0x804BB6F: (within /usr/bin/gosmore)

Two options:
1. Try rebuilding it to get the same binary but without stripping it
and then run it under gdb to determine where that address is
2. Get the bug reporter to run an unstripped binary

(might be worthwhile taking out the dh_strip from the package until
the bugs are weeded out).

I'll see what I can work out but it's not going to be easy...

Have a nice day,
--
Martijn van Oosterhout <[hidden email]> http://svana.org/kleptog/

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Martijn van Oosterhout-2
In reply to this post by Tom Hughes-3
On 8/30/07, Tom Hughes <[hidden email]> wrote:
> Does Debian have debuginfo packages like RedHat/Fedora that can
> be installed to let valgrind get the symbols?

They do, but you have to build it, and that hasn't been done.

Have a nice day,
--
Martijn van Oosterhout <[hidden email]> http://svana.org/kleptog/

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Martijn van Oosterhout-2
In reply to this post by Petter Reinholdtsen
Ok, got something: valgrind points at sprintf and gosmore only uses
that in one place. And that function is indeed slightly dodgy. Some
suggestions:

          if (!i) len += strlen (last);
          else len += sprintf (msg + len, "%s\n", last);

That should probably be strlen(last)+1. Earlier it does a len+=11, I'd
make that 12 to be on the safe side.

See if that helps,

Have a nice day,

On 8/30/07, Petter Reinholdtsen <[hidden email]> wrote:
> Now the valgrind output is available from
> <URL:http://bugs.debian.org/439732>, and gosmore seem to write past
> allocated memory, and I suspect that mess seriously with the control
> structure used by malloc() and friends.
--
Martijn van Oosterhout <[hidden email]> http://svana.org/kleptog/

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk
Reply | Threaded
Open this post in threaded view
|

Re: gosmore crashes after a few searches

Petter Reinholdtsen
[Martijn van Oosterhout]
> See if that helps,

It helped.  This patch solve the problem:

Index: gosmore.cc
===================================================================
--- gosmore.cc  (revision 4389)
+++ gosmore.cc  (working copy)
@@ -620,7 +620,7 @@

         if (strcmp (w->name + data, last)) {
           last = w->name + data;
-          if (!i) len += strlen (last);
+          if (!i) len += strlen (last) + 1;
           else len += sprintf (msg + len, "%s\n", last);
         }
       }

I've applied it to svn.

gosmore now have 31 registered users in Debian.  Check
<URL:http://qa.debian.org/popcon.php?package=gosmore> for the latest
usage count. :)

Happy hacking,
--
Petter Reinholdtsen

_______________________________________________
talk mailing list
[hidden email]
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/talk