2017-05-18 8 views
0

フラスコAPIアプリのテストに問題がありますが、一貫して起動しません。要件のため、CentOS6(デフォルトではPython 2.6)で動作することを確認する必要がありますが、カスタムPython 2.7 virtualenvを使用します。次のように私の起動コマンドは次のとおりです。フラスコのアプリは一貫して起動しません

/opt/mist/mist_base/env/bin/uwsgi --py-autoreload 1 --master --socket=/tmp/mist_app.sock --pidfile=/tmp/mist_app.pid --module=wsgi --honour-stdin --chdir=/opt/mist/mist_base/app --threads=1 --virtualenv=/opt/mist/mist_base/env --die-on-term --uid mist --gid mist

カスタムvirtualenvのは/opt/mist/mist_base/envです。

RPM/Yumを使用してこのソフトウェアをパッケージ化する手助けをしてくれました(彼はこれまでにやっていましたが、この方法でパッケージ化することが必須でした)。このプロセス中、彼は別のカスタムpython virtualenv(/opt/mist/mist_base/.localpython)をビルドするよう主張しました。残念なことに、彼はその後会社を辞めてしまいました。何が行われたのかについて詳しくはわかりません。 RPM build/initコマンドを探して、他のvirtualenvでバイナリ/ライブラリを呼び出すが、見つけられなかった。

私に提供された手順を使用して、結果のRPMを構築し、それをテストサーバーにインストールしましたが、すべて正常に動作します。私は彼のテストサーバーにインストールするために私の顧客に同じRPMを与え、それは開始しません。

次のように私の作業ブートシーケンスは次のとおりです。一方、これは私の顧客が見ているものである

*** Starting uWSGI 2.0.14 (64bit) on [Thu May 18 13:49:09 2017] *** 
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-17) on 20 March 2017 07:18:55 
os: Linux-2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Apr 11 17:13:24 UTC 2017 
nodename: mistdb 
machine: x86_64 
clock source: unix 
pcre jit disabled 
detected number of CPU cores: 4 
current working directory: /opt/mist/mist_base/app 
writing pidfile to /tmp/mist_app.pid 
detected binary path: /opt/mist/mist_base/env/bin/uwsgi 
setgid() to 487 
setuid() to 493 
chdir() to /opt/mist/mist_base/app 
your processes number limit is 7394 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to UNIX address /tmp/mist_app.sock fd 3 
Python version: 2.7.5 (default, Mar 20 2017, 06:43:30) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] 
Set PythonHome to /opt/mist/mist_base/env 
Python main interpreter initialized at 0x21c4aa0 
python threads support enabled 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 145536 bytes (142 KB) for 1 cores 
*** Operational MODE: single process *** 
WSGI app 0 (mountpoint='') ready in 2 seconds on interpreter 0x21c4aa0 pid: 24902 (default app) 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI master process (pid: 24902) 
spawned uWSGI worker 1 (pid: 24907, cores: 1) 
Python auto-reloader enabled 

*** Starting uWSGI 2.0.14 (64bit) on [Tue May 16 13:12:26 2017] *** 
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-17) on 20 March 2017 07:18:55 
os: Linux-2.6.32-696.1.1.el6.x86_64 #1 SMP Tue Mar 21 12:19:18 EDT 2017 
nodename: mist-testbed 
machine: x86_64 
clock source: unix 
pcre jit disabled 
detected number of CPU cores: 2 
current working directory:/
writing pidfile to /tmp/mist_app.pid 
detected binary path: /opt/mist/mist_base/env/bin/uwsgi 
setgid() to 497 
setuid() to 497 
chdir() to /opt/mist/mist_base/app 
your processes number limit is 15208 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to UNIX address /tmp/mist_app.sock fd 3 
Python version: 2.7.5 (default, Mar 20 2017, 06:43:30) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] 
Set PythonHome to /opt/mist/mist_base/env 
Python main interpreter initialized at 0x280c890 
python threads support enabled 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 145536 bytes (142 KB) for 1 cores 
*** Operational MODE: single process *** 
ERROR:root:code for hash md5 was not found. 
Traceback (most recent call last): 
    File "/opt/mist/mist_base/.localpython/lib/python2.7/hashlib.py", line 139, in <module> 
    globals()[__func_name] = __get_hash(__func_name) 
    File "/opt/mist/mist_base/.localpython/lib/python2.7/hashlib.py", line 103, in __get_openssl_constructor 
    return __get_builtin_constructor(name) 
    File "/opt/mist/mist_base/.localpython/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor 
    raise ValueError('unsupported hash type ' + name) 
ValueError: unsupported hash type md5 
Traceback (most recent call last): 
    File "./wsgi.py", line 1, in <module> 
    from mist_main import app as application 
    File "./mist_main.py", line 1, in <module> 
    from _app import return_app 
    File "./_app.py", line 1, in <module> 
    from flask import Flask, Blueprint, render_template, session, redirect, url_for, escape, request, abort 
    File "/opt/mist/mist_base/env/lib/python2.7/site-packages/flask/__init__.py", line 17, in <module> 
    from werkzeug.exceptions import abort 
    File "/opt/mist/mist_base/env/lib/python2.7/site-packages/werkzeug/__init__.py", line 151, in <module> 
    __import__('werkzeug.exceptions') 
    File "/opt/mist/mist_base/env/lib/python2.7/site-packages/werkzeug/exceptions.py", line 71, in <module> 
    from werkzeug.wrappers import Response 
    File "/opt/mist/mist_base/env/lib/python2.7/site-packages/werkzeug/wrappers.py", line 26, in <module> 
    from werkzeug.http import HTTP_STATUS_CODES, \ 
    File "/opt/mist/mist_base/env/lib/python2.7/site-packages/werkzeug/http.py", line 32, in <module> 
    from hashlib import md5 
ImportError: cannot import name md5 
unable to load app 0 (mountpoint='') (callable not found or import error) 
*** no app loaded. going in full dynamic mode *** 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI master process (pid: 25071) 
spawned uWSGI worker 1 (pid: 25072, cores: 1) 
Python auto-reloader enabled 

起動時に、アプリケーションは最初に、その後、.localpythonのvirtualenvのを使用しようとしますenv virtualenvを使って試行します。なぜなら、.localpythonを使用するRPM/initコードが見つからないので、なぜ私のアプリケーションインスタンスはそれを使用しないのか説明できません。2.私の顧客のインスタンスはそれをします。

環境の違いが原因である可能性があります。その仕様に基づいてVMを構築し、その問題が解決するかどうかを確認します。これは単純に壊れたvirtualenvを持つ場合や、必要な外部ライブラリがすべて含まれていない場合もありますか?

+1

「hashlib」のコンポーネントが欠落しているようです。私はこれが関連していると思う:http://stackoverflow.com/questions/20399331/error-importing-hashlib-with-python-2-7-but-not-with-2-6 – Colliot

+0

私はなぜライブラリが両方のvirtualenvsが使用されました。私の理解は 'uwsgi'が' --virtualenv'パラメータで宣言されたlibs/binariesを使用することです。今週まで、私はこの行動からの逸脱を見たことはありません。 – goterpsgo

+0

もう少し掘り下げていて、 'lib/python2.7/hashlib.py'と' __get_builtin_constructor() 'を見ています: ( 'MD5'、 'md5')のelif名: import _md5 return _md5.new '_md5'はどこにありますか?これはシステムレベルのパッケージによって提供されていますか? – goterpsgo

答えて

0

私の顧客は今日戻ってきました。彼らは私たちがしないCentOS 6サーバーに何か追加をしているようです。具体的には、彼らはサーバをFIPS対応にするためのスクリプトを実行し、私のカスタムpython 2.7環境が組み込みの暗号化ライブラリとどのようにやりとりをするのかといえます。

関連する問題