python build script hanging

371 views
Skip to first unread message

Mishael Kim

unread,
Oct 21, 2015, 6:05:28 PM10/21/15
to jenkins...@googlegroups.com

Hi,

I was hoping someone could provide some tips on how to debug/fix this issue i'm seeing.

I'm launching a python build script from within Jenkins job and the console output just seems to hang on the call.  One of the first steps within the script is to call some perforce commands using p4.  When I go to the slave machine and check the running processes, I can see that a python process and p4 process is running (as expected).  I suspect that it's some odd perforce error that is causing the hang, but I cannot tell what's going on because of the hang and no output to the console.  If I copy and paste the command directly into the command prompt to bypass Jenkins, it seems to just work fine with the expected output.

After some googling, i've unsuccessfully tried using pycharm to attach to the already running python process in hopes to getting any clues.

Can anyone point me in the right direction on how to fix/debug this issue?  Has anyone seen something similar?


Thanks,
Mishael

R. Tyler Croy

unread,
Oct 21, 2015, 7:19:37 PM10/21/15
to jenkins...@googlegroups.com
(replies inline)
Just a stab in the dark, is the command expecting standard in/out to be
present/correct? There's a bunch of different ways to spawn subprocesses in
Python to better emulate what your shell already does in terms of setting up
pipes.


When you're running the command outside of Jenkins, are you still running it
with the Jenkins user on the machine? If not, it may be relying on some state
in $HOME or elsewhere that the command doesn't have when executing on the build
node itself.



Just a couple random thoughts, good luck :)


- R. Tyler Croy

------------------------------------------------------
Code: <https://github.com/rtyler>
Chatter: <https://twitter.com/agentdero>

% gpg --keyserver keys.gnupg.net --recv-key 3F51E16F
------------------------------------------------------
signature.asc

Eric Pyle

unread,
Oct 21, 2015, 7:21:15 PM10/21/15
to jenkins...@googlegroups.com
Try running Python with the -u option (unbuffered output). Otherwise the output from Python is not in sync with what is happening in real time.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMzA64kzua0QcsWi6rxuzyBs%2B-pThxe8FhGEjCRn4c4MGzs--g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Mishael Kim

unread,
Oct 21, 2015, 7:41:57 PM10/21/15
to jenkins...@googlegroups.com
Awesome.  Getting some more info with the unbuffered output.  Are there any potential side effects when using this?  Performance?
Thanks!

Eric Pyle

unread,
Oct 21, 2015, 8:00:53 PM10/21/15
to jenkins...@googlegroups.com
Depends what you're doing with Python but unless there's a lot of I/O I wouldn't expect a lot of difference. I use it all the time for software build scripting.
Reply all
Reply to author
Forward
0 new messages