Web app shuts down (502 error) while running a int

2019-07-31 13:12发布

问题:

I have a Python 3.3, mongodb, cron webapp on Openshifts free tier.

I know that the Openshift free tier has a 5 minute time limit for running cron jobs or external processes. As an experiment I tried running my task in a thread off my main web app.

I would think since the task a thread it would not be subject to the 5 minute limit because it's all apart of the main web app process.

However, when I start my app which starts the thread task the app gets shut down in 2-3 minutes and give a 502 proxy error. A restart is necessary. I pulled this from the 'tail'

Any ideas what is going on? Does Openshift a CPU cycle limit also? Am I hitting some resource limit on Openshift? Any way to tell?

    Thu May 15 13:15:53.047 [signalProcessingThread] got signal 15 (Terminated), will terminate after current cmd ends
    Thu May 15 13:15:53.048 [signalProcessingThread] now exiting
    Thu May 15 13:15:53.058 dbexit:
    Thu May 15 13:15:53.058 [signalProcessingThread] shutdown: going to close listening sockets...
    Thu May 15 13:15:53.058 [signalProcessingThread] closing listening socket: 11
    Thu May 15 13:15:53.058 [signalProcessingThread] shutdown: going to flush diaglog...
    Thu May 15 13:15:53.058 [signalProcessingThread] shutdown: going to close sockets...
    Thu May 15 13:15:53.111 [signalProcessingThread] shutdown: waiting for fs preallocator...
    Thu May 15 13:15:53.111 [signalProcessingThread] shutdown: lock for final commit...
    Thu May 15 13:15:53.111 [signalProcessingThread] shutdown: final commit...
    Thu May 15 13:15:53.112 [signalProcessingThread] shutdown: closing all files...
    Thu May 15 13:15:53.112 [signalProcessingThread] closeAllFiles() finished
    Thu May 15 13:15:53.112 [signalProcessingThread] journalCleanup...
    Thu May 15 13:15:53.112 [signalProcessingThread] removeJournalFiles
    Thu May 15 13:15:53.145 [signalProcessingThread] shutdown: removing fs lock...
    Thu May 15 13:15:53.166 dbexit: really exiting now


    You can tail this application directly with:
    ssh -t XXXXXXXX@XXXXXXXXXXX.rhcloud.com 'tail */logs/*'

    C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/ruby_compat.rb:30:in `select': closed stream (IOError)
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/ruby_compat.rb:30:in `io_select'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/transport/packet_stream.rb:73:in `available_for_read?'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/transport/packet_stream.rb:85:in `next_packet'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/transport/session.rb:172:in `block in poll_message'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/transport/session.rb:167:in `loop'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/transport/session.rb:167:in `poll_message'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:454:in `dispatch_incoming_packets'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:216:in `preprocess'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:200:in `process'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:164:in `block in loop'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:164:in `loop'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh/connection/session.rb:164:in `loop'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/ssh_helpers.rb:51:in `block in ssh_ruby'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/net-ssh-2.6.7/lib/net/ssh.rb:199:in `start'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/ssh_helpers.rb:39:in `ssh_ruby'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/commands/tail.rb:39:in `tail'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/commands/tail.rb:20:in `run'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/commands.rb:240:in `execute'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/commands.rb:231:in `block (3 levels) in to_commander'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/command.rb:180:in `call'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/command.rb:155:in `run'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/runner.rb:402:in `run_active_command'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/command_runner.rb:70:in `run!'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/commander-4.1.3/lib/commander/delegates.rb:7:in `run!'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/lib/rhc/cli.rb:36:in `start'
    from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rhc-1.7.8/bin/rhc:18:in `<top (required)>'
    from C:/Ruby200-x64/bin/rhc:23:in `load'
    from C:/Ruby200-x64/bin/rhc:23:in `<main>'

回答1:

OpenShift Online has disk space, memory, and cpu limitations depending on what size gear you are using. It is very possible that if you are using the free account (a small gear) that your application is either running out of memory or cpu cycles. You can try checking for memory limit violations using this KB article: https://www.openshift.com/kb/kb-e1082-how-to-check-for-memory-limit-violations



标签: openshift