Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I've broken something ... #500

Closed
lsces opened this issue Nov 12, 2015 · 6 comments
Closed

I've broken something ... #500

lsces opened this issue Nov 12, 2015 · 6 comments

Comments

@lsces
Copy link

lsces commented Nov 12, 2015

I've had a system running for a couple of years now which I thought was keeping up to date, but have realised that it is perhaps still a little behind on the current version of data. Probably cleaner to start again and do a complete new upload, but just trying to understand what I broke.
SUSE13.1 with osm2pgsql 0.89.0-dev loaded which was not the version that was running, so problems with 'pending' fields which I've deleted from the database, but now it goes as far as 'Using XML parser.' and seems to stall.
What is the easiest approach to debug this as I'm sure it should be able to pick up and input the changes files?

@alex85k
Copy link
Contributor

alex85k commented Nov 12, 2015

The simplest way to debug this: run osm2pgsql inside gdb

 gdb -ex=r --args ./osm2pgsql  .......

press Ctrl-C when it hangs and then enter bt command. You'll get the call stack (maybe you would want to put it here) and see what function is doing wrong things.

You can also open osm2pgsql sources as a project in QtCreator (it supports cmake) and do interactive debugging (may need to copy style file, change the command line, setup PSUSER & PGPASSWORD variables etc).

@lsces
Copy link
Author

lsces commented Nov 12, 2015

Need to install all the debug libraries but ...

Reading in file: 896702.changes.osc.gz
Using XML parser.
[New Thread 0x7fffb562a700 (LWP 22247)]
[New Thread 0x7fffb4e29700 (LWP 22248)]
^C
Program received signal SIGINT, Interrupt.
0x00007ffff5bf306d in poll () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff5bf306d in poll () from /lib64/libc.so.6
#1 0x00007ffff77a789e in ?? () from /usr/lib64/libpq.so.5
#2 0x00007ffff77a7920 in ?? () from /usr/lib64/libpq.so.5
#3 0x00007ffff77a5c19 in PQgetResult () from /usr/lib64/libpq.so.5
#4 0x00007ffff77a5f1e in ?? () from /usr/lib64/libpq.so.5
#5 0x00000000004e24a0 in pgsql_execPrepared(pg_conn_, char const_, int, char const* const*, ExecStatusType) ()
#6 0x00000000004b815f in middle_pgsql_t::node_changed(long) ()
#7 0x000000000047abda in osmdata_t::node_modify(long, double, double, taglist_t const&) ()
#8 0x000000000049483f in parse_osmium_t::node(osmium::Node&) ()
#9 0x0000000000495378 in parse_osmium_t::stream_file(std::string const&, std::string const&) ()
#10 0x000000000046d9a3 in main ()
(gdb)

@alex85k
Copy link
Contributor

alex85k commented Nov 12, 2015

No need for debug postgresql libraries, it is hanging on executing prepared SQL statement pgsql_execPrepared (something with database itself, most likely).

You can take one of the ways:

  1. See the query with the debugger (do not know exact command for gdb)
  2. Add add_definintions(-DDEBUG_PGSQL) into CMakeLists.txt an rebuild osm2pgsql - it will print all queries after this.
  3. Add more printf calls manually into the code.

@lsces
Copy link
Author

lsces commented Nov 12, 2015

OK ... getting too complicated for time available ...
http://wiki.openstreetmap.org/wiki/Osm2pgsql/schema is obviously out of date but I can't find a clean schema to check what I've now got is correct, and more important, the scripts I have will add the 'pending' fields back in which were the original crash point. So where do I find a current postgres setup cribsheet?

@pnorman
Copy link
Collaborator

pnorman commented Nov 12, 2015

https://github.com/openstreetmap/osm2pgsql#usage for osm2pgsql specific parts, see your OS documentation for how to install PostgreSQL.

@lsces
Copy link
Author

lsces commented Nov 12, 2015

My original crib sheets were getting a bit out of date and had scripts for setting some things up prior to osm2pgsql. Just reworking the bits I'd missed for SUSE installs, however still fighting a problem between 13.1 and 13.2 builds.
BUT I needed the -C xxx to import the UK subset and missed that the --slim is needed to get the --append to work as I think originally that was already configured by the scripts. Just re-running the populate so I can retest the cron task to update.

@lonvia lonvia closed this as completed Feb 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants