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

when i use Model,then will get this error:IndexError: pop from an empty deque #56

Open
MarkLiu1 opened this issue May 9, 2024 · 1 comment

Comments

@MarkLiu1
Copy link

MarkLiu1 commented May 9, 2024

Built web service with Flask+ uWSGI + pmml ,And enable multi-threading

file "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 982, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

The complete error exception is
File "/usr/local/lib/python3.7/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.7/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 "app.py", line 346, in get_model_result_v2
result = fd.predict(req_json)
File "./fkdqv11v12rhmodelscore_S1_0/fkdqv11v12rhmodelscore_S1_0.py", line 401, in predict
features_pd_model = self._derive(data)
File "./fkdqv11v12rhmodelscore_S1_0/fkdqv11v12rhmodelscore_S1_0.py", line 337, in _derive
result_v12 = self._derive_v12(data)
File "./fkdqv11v12rhmodelscore_S1_0/fkdqv11v12rhmodelscore_S1_0.py", line 198, in _derive_v12
lgb_v12_model_1_prob = lgb_v12_model_1.predict(res)['probability(1)']
File "/usr/local/lib/python3.7/site-packages/pypmml/model.py", line 155, in predict
return self.call('predict', data)
File "/usr/local/lib/python3.7/site-packages/pypmml/base.py", line 134, in call
return call_java_func(getattr(self._java_model, name), *a)
File "/usr/local/lib/python3.7/site-packages/pypmml/base.py", line 41, in call_java_func
return _java2py(func(*args))
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1314, in call
args_command, temp_args = self._build_args(*args)
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1277, in _build_args
(new_args, temp_args) = self._get_args(args)
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1264, in _get_args
temp_arg = converter.convert(arg, self.gateway_client)
File "/usr/local/lib/python3.7/site-packages/py4j/java_collections.py", line 521, in convert
java_map = HashMap()
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1586, in call
answer = self._gateway_client.send_command(command)
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 1036, in send_command
connection = self._get_connection()
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 984, in _get_connection
connection = self._create_connection()
File "/usr/local/lib/python3.7/site-packages/py4j/java_gateway.py", line 990, in _create_connection
connection.start()
File "/usr/local/lib/python3.7/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:41543)

@scorebot
Copy link
Member

It seems an issue of py4j that is used by pypmml, there is a related issue: py4j/py4j#325
You can try to increase memory for JVM, for example:

import os
os.environ['JAVA_OPTS'] = '-Xms1g -Xmx4g'

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

2 participants