Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Py4j Error #17

Open
iazdan opened this issue Aug 8, 2022 · 8 comments
Open

Py4j Error #17

iazdan opened this issue Aug 8, 2022 · 8 comments

Comments

@iazdan
Copy link

iazdan commented Aug 8, 2022

py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:)

@lessthanoptimal
Copy link
Owner

Can you provide more information? Did it happen immediately? What's your operating system?

@vitoivan
Copy link

vitoivan commented Sep 20, 2022

@lessthanoptimal same error here

Launching Java process: java_port=25333 python_port=25334
Failed to successfully launch the JVM after 5 seconds.  Aborting
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 982, in _get_connection
    connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 1132, in start
    self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/uvicorn", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 437, in main
    run(app, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/uvicorn/main.py", line 463, in run
    server.run()
  File "/usr/local/lib/python3.9/site-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/local/lib/python3.9/asyncio/runners.py", line 44, in run
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/app/./api/app.py", line 7, in <module>
    controllers.init(app)
  File "/app/./api/controllers/__init__.py", line 6, in init
    from .scan import scan_by_image_by_url
  File "/app/./api/controllers/scan.py", line 1, in <module>
    from api.services.scan_by_url_service import scan_by_url_service
  File "/app/./api/services/scan_by_url_service.py", line 2, in <module>
    from scanner import Scanner
  File "/app/./scanner/__init__.py", line 1, in <module>
    from ._pyboof.scanner import PyboofScanner
  File "/app/./scanner/_pyboof/scanner.py", line 3, in <module>
    import pyboof as pb
  File "/usr/local/lib/python3.9/site-packages/pyboof/__init__.py", line 244, in <module>
    init_pyboof(java_port=int(os.environ.get('PYBOOF_JAVA_PORT', 25333)),
  File "/usr/local/lib/python3.9/site-packages/pyboof/__init__.py", line 79, in init_pyboof
    __init_memmap(size_mb)
  File "/usr/local/lib/python3.9/site-packages/pyboof/__init__.py", line 151, in __init_memmap
    gateway.jvm.pyboof.PyBoofEntryPoint.initializeMmap(mmap_path, size_mb)
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 1712, in __getattr__
    answer = self._gateway_client.send_command(
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 1036, in send_command
    connection = self._get_connection()
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 984, in _get_connection
    connection = self._create_connection()
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 990, in _create_connection
    connection.start()
  File "/usr/local/lib/python3.9/site-packages/py4j/java_gateway.py", line 1144, in start
    raise Py4JNetworkError(msg, e)
py4j.protocol.Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:25333)

@lessthanoptimal
Copy link
Owner

@vitoivan PyBoof version and what's your system?

@vitoivan
Copy link

@lessthanoptimal PyBoof==0.40.1 , using FROM python:3.9 in dockerfile, so that uses probabily some alpineXX system.
I'm using also openjdk-11.
So that's my problem, my docker image build and runs successfully locally. But when i run it in a kubernetes pod i have this error.

@lessthanoptimal
Copy link
Owner

FYI PyBoof 0.41 is out. Doubt it will fix issue.

Just punched part of your error message into google with "docker" and there might be others with a similar issue. I'm a docker novice.

@lessthanoptimal
Copy link
Owner

Current SNAPSHOT branch code might fix this. See #18

@xuhelene
Copy link

xuhelene commented Sep 1, 2023

hava you solved this problem? I got the same problem with pyboof version 0.43.1

@vitoivan
Copy link

vitoivan commented Nov 1, 2023

hava you solved this problem? I got the same problem with pyboof version 0.43.1

I found out that my problem was that my service has not enought memory for Pyboof. It work well when i increase my container's memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants