/srv/irclogs.ubuntu.com/2013/01/03/#upstart.txt

tzafrir_laptopIf I package a package with a upstart file, should I remove the existing init script?14:54
tzafrir_laptopIs there anything wrong with having both of them?14:54
afournierdisk space ? :p15:02
afournierdouble init ?15:02
tzafrir_laptopafournier, yes, double init15:15
tzafrir_laptopWhen I removed the init script and rebuilt the package I got an odd warning from lintian15:15
tzafrir_laptopabout the init.d script missing15:16
afournierlintian ?15:30
JanCtzafrir_laptop: Ubuntu packages usually symlink a special init script ('/lib/init/upstart-job') in /etc/init.d/ to replace the original init script15:30
afournierit's possible that your package contains pre/post install scripts15:30
tzafrir_laptopLooks like dh_installinit automatically generates code in postinst script for the init script15:39
tzafrir_laptopEven though I don;t have it.15:39
tzafrir_laptopAnd this causes: W: init.d-script-not-marked-as-conffile and E: init.d-script-not-included-in-package15:40
tzafrir_laptopNo symlink was created15:40
tzafrir_laptopnither in the package nor in a postinst script15:41
Dirangedhey im fighting with upstart and uwsgi right now… when we run our uwsgi service manually (command line) it works perfectly. but when we run the exact same commands in an upstart job, we end up with a threading problem in our django app that causes the app to hang18:40
Dirangeddoes upstart do anything strange to the environment, or fork anything in a funny way that might break like this?18:40
geofftI don't know a ton here, but upstart ptraces jobs to figure out if a daemon has forked yet, which sounds vaguely relevant. 18:43
geofftYou might want to play with the 'expect' commands? 18:43
Dirangedhmm.. 18:44
geofftin the job configuration (expect fork, etc.) 18:44
Dirangedexpect fork didnt help.. 18:46
Dirangedactually it seems to break it.. it starts up, but then i cant kill the app18:46
SpamapSDiranged: yeah only use expect fork if your program actually daemonizes18:48
Dirangedah yeah.. sorry, uwsgi doesnt in emperor mode..18:48
SpamapSif you're not using expect fork, you won't be ptracing18:48
Dirangedis there a way to "restart" upstart so that it reloads the config? it kind of hangs after this.. 18:49
SpamapSupstart will simply fork, and exec. nothing special.18:49
Dirangedok.. hrmm18:49
DirangedSpamapS: https://gist.github.com/444553218:49
SpamapSDiranged: if you incorrectly specify expect fork, the only way to get rid of the dead pid is to re-exhaust the pid space until that pid exists. Its a well known bug18:49
Dirangedthats basically our uwsgi config.. (minus the "—master " .. that was a test)18:49
SpamapSone that I believe has a solution forthcoming.. finally18:49
SpamapSDiranged: I suspect there's something in your environment variables or ulimits / umask that makes it work when you run it directly18:50
Dirangedhmmmm18:50
SpamapSDiranged: are you 100% positive you want to run that as root?18:50
DirangedSpamapS:  the master process needs to run as root.. but it doesnt spawn any of the children as root18:50
Dirangedbut hmm18:50
Dirangedyou bring up ani nteresting point18:50
Diranged(about the ulimits)18:50
Dirangedi wonder if theres a way to check that.. 18:51
SpamapSjust change the 'exec' line to 'exec bash -c "ulimit -a"' and look at what it says18:52
Dirangedthere are a few subtle differences.. hmm18:54
SpamapSDiranged: is uwsgi logging why it fails?18:57
DirangedSpamapS: yeah so the django app starts up under the uwsgi vessal and begins to do its work. it creates a connection with Kazoo to our zookeeper service, and then immediately hangs. the connection fails, and an execption is raised18:59
DirangedSpamapS: the connection is handled in a python Threading object.. so my guess is that the object and/or connection is being broken somehow. but as i mentioned, it ONLY happens when we run inside of upstarts… 18:59
Dirangedcan i set specific limits for my upstart job in the upstart config file?19:00
SpamapSDiranged: lots of threaded python stuff runs under upstart, so I can't imagine why that would cause issues.19:00
* SpamapS points at openstack19:00
SpamapSlots of threaded python stuff :)19:00
Dirangedi know.. im totally stunned by this..19:00
Dirangedand this isnt the only thread we run.. its just the first one we've seen that does this19:00
SpamapSDiranged: does it, by any chance, open stdin and try to select() it or something.. where when its attached to your terminal, thats fine, but in upstart, that might just block19:02
* SpamapS is grasping at straws19:02
DirangedSpamapS:  how messed up is this … zk_watcher (an app we wrote in house) that we run with upstart, leverages nd_service_registry (which is our kazoo management api), and it works perfectly fine19:02
geofftYeah, I'm also surprised. It's just that given that you're having problems, ptrace sounded like an easy thing to blame 19:02
DirangedSpamapS:  this only fails under uwsgi, under upstart.. 19:02
SpamapSgeofft: ptrace is not  used at all without expect fork/daemon19:04
Dirangedhttps://gist.github.com/4440744 < the log of the kazoo failure.. it basically hangs at "xid: 1".. and 15 seconds later, a timeout hits and an exception is raised.. 19:07
Diranged(not that helpful.. but just in case)19:07
SpamapSDiranged: crazy thought, strace the program19:08
Dirangedive tried a bit .. but im not a big strace reader.. though, we have  a few devs here who are, so i may get them involved19:08
SpamapSits pretty simple19:10
Dirangedill run it once via cli and make it work and trace it.. then ill run another time via upstart and trace it.. we'll see what happens19:10
Dirangedugh,.. i still think this is upstart+uwsgi related, but im going back to the uwsgi channel to debug this a bit more with them19:33
geofftSpamapS: ah, okay. I thought there was a default that involved ptracing, but apparently I was wrong 19:42
Dirangedthis has SOMETHING to do with the way our wsgi app is loading19:42
Dirangedbecause if i init *a* kazoo object right inside of our wsgi file (before the application is really loaded), then it initalizes fine.. and THEN our app init's its own kazoo object, and works fine..19:43
Diranged(leaving us with 2 connections.. which is bad.. but still.. its some progress)19:43
DirangedSpamapS: hey just circling around.. the issue is somewhere in our Django app. If we set the LANG variable in our uwsgi app, it works fine.. if we dont, it fails. Upstart just wasnt getting that environment variable. 22:06
Dirangedi have no idea why that variable means so much to the way Django handles connections/threads… we're sitll digging in … but its not an upstart failure22:06
SpamapSDiranged: *ahh LANG*22:06
SpamapSDiranged: right, you can't realy assume any environment variables in upstart jobs22:07
Dirangedyeah.. itrs funny, we dont.. but it must be something burried in the python code somewhere22:07
SpamapSDiranged: I suspect its more that some underlying library wants it to be set..perhaps a non-thread-safe-error-handler is the issue22:07
Dirangedyeah.. im still diggin around trying to understand it..22:07
SpamapSDiranged: glad you got some insight though. I'd say 99% of the time when somebody has a problem with an upstart job that works fine in a login shell, its environment variables22:08
Dirangedmakes sense.. well, now its time for me to dig into the python..22:09
Dirangedi dont mind setting that vairable, but i want to understand WHY i need to22:09
SpamapSDiranged: yeah, I would too22:13
Dirangedthanks again for hte help.. ttyl22:16

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!