Giter VIP home page Giter VIP logo

Comments (6)

jsirois avatar jsirois commented on August 13, 2024

@mariano-filipe can you provide a small repro? That would help tremendously.

from pex.

jsirois avatar jsirois commented on August 13, 2024

Ok, I figured out the repro, but its great when you can do this when submitting a bug report, especially when it involves systems outside the one you're reporting against:

:; cat app.py
from gevent import monkey
monkey.patch_all()

from flask import Flask


app = Flask(__name__)


@app.route('/')
def hello_world():
    return 'Hello, World!'

:; pex flask gevent gunicorn --module app -c gunicorn --inject-args app:app -o app.pex
:; ./app.pex &
[1] 46657
:; [2024-06-04 15:20:40 -0700] [46657] [INFO] Starting gunicorn 22.0.0
[2024-06-04 15:20:40 -0700] [46657] [INFO] Listening at: http://127.0.0.1:8000 (46657)
[2024-06-04 15:20:40 -0700] [46657] [INFO] Using worker: sync
[2024-06-04 15:20:40 -0700] [46728] [INFO] Booting worker with pid: 46728
/home/jsirois/dev/pex-tool/pex/app.py:2: MonkeyPatchWarning: Monkey-patching ssl after ssl has already been imported may lead to errors, including RecursionError on Python 3.6. It may also silently lead to incorrect behaviour on Python 3.7. Please monkey-patch earlier. See https://github.com/gevent/gevent/issues/1016. Modules that had direct imports (NOT patched): ['pex.fetcher (/home/jsirois/.pex/unzipped_pexes/1f919528d7942b66beb34e5b56a696a21ae82673/.bootstrap/pex/fetcher.py)'].
  monkey.patch_all()

:; curl http://127.0.0.1:8000
Hello, World!

from pex.

jsirois avatar jsirois commented on August 13, 2024

The warning turns out to be a red-herring. Although pex/fetcher.py is included in the PEX .bootstrap/, it is unused; so gevent is missing the mark here. Nonetheless, the .bootstrap/ should only contain Pex code needed to boot a PEX file and so pex/fetcher.py should go.

from pex.

jsirois avatar jsirois commented on August 13, 2024

Ok, pex/fetcher.py can actually be used at runtime in the case of a --venv PEX, although a re-exec happens after that, clearing state and that use also does not call install_pip which is the only case where an URLFetcher might be used. As such, just making the import ssl lazy is enough.

from pex.

mariano-filipe avatar mariano-filipe commented on August 13, 2024

@jsirois thanks a lot for the quick response and explanation. The new version will help us moving forward with new pants versions too. Appreaciate it 🙏🏽

from pex.

jsirois avatar jsirois commented on August 13, 2024

Ok @mariano-filipe the fix is released:

from pex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.