Dialog failed in the wab web page #6965

Closed
opened 2026-02-21 18:18:09 -05:00 by yindo · 4 comments
Owner

Originally created by @vank3f3 on GitHub (Nov 26, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.12.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Dialog failed in the wab web page.
image

My original 0.11.0 was fine, but when I upgraded to 0.12.1, there was an error.
logs :

2024-11-27 03:12:58,883.883 ERROR [Thread-10 (_generate_worker)] [app_generator.py:232] - Unknown Error when generating
2024-11-27T11:12:58.887185590+08:00 Traceback (most recent call last):
2024-11-27T11:12:58.887195467+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen
    response = self._make_request(
2024-11-27T11:12:58.887206113+08:00                ^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887211608+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request
2024-11-27T11:12:58.887216805+08:00     raise new_e
2024-11-27T11:12:58.887222413+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request
    self._validate_conn(conn)
2024-11-27T11:12:58.887240702+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn
    conn.connect()
2024-11-27T11:12:58.887252371+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 730, in connect
2024-11-27T11:12:58.887257967+08:00     sock_and_verified = _ssl_wrap_socket_and_match_hostname(
2024-11-27T11:12:58.887263264+08:00                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887268346+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 909, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
               ^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887283263+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 469, in ssl_wrap_socket
2024-11-27T11:12:58.887288481+08:00     ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 513, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887313709+08:00   File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 122, in wrap_socket
    return self.sslsocket_class(
2024-11-27T11:12:58.887322526+08:00            ^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887327249+08:00   File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 351, in __init__
    self.do_handshake()
2024-11-27T11:12:58.887336933+08:00   File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 740, in do_handshake
2024-11-27T11:12:58.887341549+08:00     self._sslobj.do_handshake()
2024-11-27T11:12:58.887345913+08:00 ConnectionResetError: [Errno 104] Connection reset by peer
2024-11-27T11:12:58.887349868+08:00 
2024-11-27T11:12:58.887354406+08:00 During handling of the above exception, another exception occurred:

2024-11-27T11:12:58.887362748+08:00 Traceback (most recent call last):
2024-11-27T11:12:58.887366946+08:00   File "/app/api/.venv/lib/python3.12/site-packages/requests/adapters.py", line 486, in send
2024-11-27T11:12:58.887371651+08:00     resp = conn.urlopen(
2024-11-27T11:12:58.887375989+08:00            ^^^^^^^^^^^^^
2024-11-27T11:12:58.887380329+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 843, in urlopen
2024-11-27T11:12:58.887394144+08:00     retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887402904+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment
2024-11-27T11:12:58.887407405+08:00     raise reraise(type(error), error, _stacktrace)
2024-11-27T11:12:58.887411824+08:00           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887422807+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise
2024-11-27T11:12:58.887431094+08:00     raise value.with_traceback(tb)
2024-11-27T11:12:58.887435490+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen
2024-11-27T11:12:58.887439732+08:00     response = self._make_request(
2024-11-27T11:12:58.887443824+08:00                ^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request
2024-11-27T11:12:58.887452224+08:00     raise new_e
2024-11-27T11:12:58.887456507+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request
2024-11-27T11:12:58.887460945+08:00     self._validate_conn(conn)
  File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn
2024-11-27T11:12:58.887469653+08:00     conn.connect()
  File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 730, in connect
2024-11-27T11:12:58.887478324+08:00     sock_and_verified = _ssl_wrap_socket_and_match_hostname(
2024-11-27T11:12:58.887482791+08:00                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887487134+08:00   File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 909, in _ssl_wrap_socket_and_match_hostname
    ssl_sock = ssl_wrap_socket(
2024-11-27T11:12:58.887495906+08:00                ^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 469, in ssl_wrap_socket
2024-11-27T11:12:58.887504833+08:00     ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
2024-11-27T11:12:58.887509148+08:00                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 513, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
2024-11-27T11:12:58.887533611+08:00            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 122, in wrap_socket
2024-11-27T11:12:58.887542289+08:00     return self.sslsocket_class(
2024-11-27T11:12:58.887546330+08:00            ^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887550850+08:00   File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 351, in __init__
    self.do_handshake()
2024-11-27T11:12:58.887559171+08:00   File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 740, in do_handshake
2024-11-27T11:12:58.887563415+08:00     self._sslobj.do_handshake()
2024-11-27T11:12:58.887567810+08:00 urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

2024-11-27T11:12:58.887580780+08:00 During handling of the above exception, another exception occurred:
2024-11-27T11:12:58.887590961+08:00 
2024-11-27T11:12:58.887595311+08:00 Traceback (most recent call last):
2024-11-27T11:12:58.887599715+08:00   File "/app/api/core/app/apps/chat/app_generator.py", line 212, in _generate_worker
2024-11-27T11:12:58.887604030+08:00     runner.run(
2024-11-27T11:12:58.887608385+08:00   File "/app/api/core/app/apps/chat/app_runner.py", line 58, in run
2024-11-27T11:12:58.887612626+08:00     self.get_pre_calculate_rest_tokens(
2024-11-27T11:12:58.887616952+08:00   File "/app/api/core/app/apps/base_app_runner.py", line 86, in get_pre_calculate_rest_tokens
2024-11-27T11:12:58.887621484+08:00     prompt_tokens = model_instance.get_llm_num_tokens(prompt_messages)
2024-11-27T11:12:58.887625801+08:00                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/core/model_manager.py", line 154, in get_llm_num_tokens
2024-11-27T11:12:58.887635265+08:00     return self._round_robin_invoke(
2024-11-27T11:12:58.887640301+08:00            ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887645291+08:00   File "/app/api/core/model_manager.py", line 310, in _round_robin_invoke
2024-11-27T11:12:58.887650662+08:00     return function(*args, **kwargs)
2024-11-27T11:12:58.887655849+08:00            ^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887660882+08:00   File "/app/api/core/model_runtime/model_providers/openai/llm/llm.py", line 282, in get_num_tokens
2024-11-27T11:12:58.887666187+08:00     return self._num_tokens_from_messages(base_model, prompt_messages, tools)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887676434+08:00   File "/app/api/core/model_runtime/model_providers/openai/llm/llm.py", line 1001, in _num_tokens_from_messages
2024-11-27T11:12:58.887681431+08:00     encoding = tiktoken.encoding_for_model(model)
2024-11-27T11:12:58.887686246+08:00                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/model.py", line 105, in encoding_for_model
    return get_encoding(encoding_name_for_model(model_name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/registry.py", line 86, in get_encoding
    enc = Encoding(**constructor())
2024-11-27T11:12:58.887717266+08:00                      ^^^^^^^^^^^^^
2024-11-27T11:12:58.887722842+08:00   File "/app/api/.venv/lib/python3.12/site-packages/tiktoken_ext/openai_public.py", line 96, in o200k_base
2024-11-27T11:12:58.887727892+08:00     mergeable_ranks = load_tiktoken_bpe(
                      ^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887738540+08:00   File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/load.py", line 144, in load_tiktoken_bpe
2024-11-27T11:12:58.887743828+08:00     contents = read_file_cached(tiktoken_bpe_file, expected_hash)
2024-11-27T11:12:58.887748830+08:00                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/load.py", line 63, in read_file_cached
    contents = read_file(blobpath)
2024-11-27T11:12:58.887763802+08:00                ^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887768972+08:00   File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/load.py", line 24, in read_file
2024-11-27T11:12:58.887777208+08:00     resp = requests.get(blobpath)
2024-11-27T11:12:58.887782403+08:00            ^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887787086+08:00   File "/app/api/.venv/lib/python3.12/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
2024-11-27T11:12:58.887796614+08:00            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887801564+08:00   File "/app/api/.venv/lib/python3.12/site-packages/requests/api.py", line 59, in request
2024-11-27T11:12:58.887806174+08:00     return session.request(method=method, url=url, **kwargs)
2024-11-27T11:12:58.887810869+08:00            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887815529+08:00   File "/app/api/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
2024-11-27T11:12:58.887820192+08:00     resp = self.send(prep, **send_kwargs)
2024-11-27T11:12:58.887825159+08:00            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-11-27T11:12:58.887829683+08:00   File "/app/api/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
2024-11-27T11:12:58.887846311+08:00         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/api/.venv/lib/python3.12/site-packages/requests/adapters.py", line 501, in send
2024-11-27T11:12:58.887869006+08:00     raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
2024-11-27 03:12:58,907.907 ERROR [Dummy-11] [base_app_generate_response_converter.py:131] - ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

✔️ Expected Behavior

Correct return

Actual Behavior

Error response

Originally created by @vank3f3 on GitHub (Nov 26, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.12.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Dialog failed in the wab web page. ![image](https://github.com/user-attachments/assets/dc070ad1-7e2e-48e4-838a-97d058f5ed2f) My original 0.11.0 was fine, but when I upgraded to 0.12.1, there was an error. logs : ``` 2024-11-27 03:12:58,883.883 ERROR [Thread-10 (_generate_worker)] [app_generator.py:232] - Unknown Error when generating 2024-11-27T11:12:58.887185590+08:00 Traceback (most recent call last): 2024-11-27T11:12:58.887195467+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( 2024-11-27T11:12:58.887206113+08:00 ^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887211608+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request 2024-11-27T11:12:58.887216805+08:00 raise new_e 2024-11-27T11:12:58.887222413+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request self._validate_conn(conn) 2024-11-27T11:12:58.887240702+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn conn.connect() 2024-11-27T11:12:58.887252371+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 730, in connect 2024-11-27T11:12:58.887257967+08:00 sock_and_verified = _ssl_wrap_socket_and_match_hostname( 2024-11-27T11:12:58.887263264+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887268346+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 909, in _ssl_wrap_socket_and_match_hostname ssl_sock = ssl_wrap_socket( ^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887283263+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 469, in ssl_wrap_socket 2024-11-27T11:12:58.887288481+08:00 ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 513, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887313709+08:00 File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 122, in wrap_socket return self.sslsocket_class( 2024-11-27T11:12:58.887322526+08:00 ^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887327249+08:00 File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 351, in __init__ self.do_handshake() 2024-11-27T11:12:58.887336933+08:00 File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 740, in do_handshake 2024-11-27T11:12:58.887341549+08:00 self._sslobj.do_handshake() 2024-11-27T11:12:58.887345913+08:00 ConnectionResetError: [Errno 104] Connection reset by peer 2024-11-27T11:12:58.887349868+08:00 2024-11-27T11:12:58.887354406+08:00 During handling of the above exception, another exception occurred: 2024-11-27T11:12:58.887362748+08:00 Traceback (most recent call last): 2024-11-27T11:12:58.887366946+08:00 File "/app/api/.venv/lib/python3.12/site-packages/requests/adapters.py", line 486, in send 2024-11-27T11:12:58.887371651+08:00 resp = conn.urlopen( 2024-11-27T11:12:58.887375989+08:00 ^^^^^^^^^^^^^ 2024-11-27T11:12:58.887380329+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 843, in urlopen 2024-11-27T11:12:58.887394144+08:00 retries = retries.increment( ^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887402904+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment 2024-11-27T11:12:58.887407405+08:00 raise reraise(type(error), error, _stacktrace) 2024-11-27T11:12:58.887411824+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887422807+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise 2024-11-27T11:12:58.887431094+08:00 raise value.with_traceback(tb) 2024-11-27T11:12:58.887435490+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen 2024-11-27T11:12:58.887439732+08:00 response = self._make_request( 2024-11-27T11:12:58.887443824+08:00 ^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request 2024-11-27T11:12:58.887452224+08:00 raise new_e 2024-11-27T11:12:58.887456507+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request 2024-11-27T11:12:58.887460945+08:00 self._validate_conn(conn) File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn 2024-11-27T11:12:58.887469653+08:00 conn.connect() File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 730, in connect 2024-11-27T11:12:58.887478324+08:00 sock_and_verified = _ssl_wrap_socket_and_match_hostname( 2024-11-27T11:12:58.887482791+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887487134+08:00 File "/app/api/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 909, in _ssl_wrap_socket_and_match_hostname ssl_sock = ssl_wrap_socket( 2024-11-27T11:12:58.887495906+08:00 ^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 469, in ssl_wrap_socket 2024-11-27T11:12:58.887504833+08:00 ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) 2024-11-27T11:12:58.887509148+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 513, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) 2024-11-27T11:12:58.887533611+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 122, in wrap_socket 2024-11-27T11:12:58.887542289+08:00 return self.sslsocket_class( 2024-11-27T11:12:58.887546330+08:00 ^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887550850+08:00 File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 351, in __init__ self.do_handshake() 2024-11-27T11:12:58.887559171+08:00 File "/app/api/.venv/lib/python3.12/site-packages/gevent/ssl.py", line 740, in do_handshake 2024-11-27T11:12:58.887563415+08:00 self._sslobj.do_handshake() 2024-11-27T11:12:58.887567810+08:00 urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) 2024-11-27T11:12:58.887580780+08:00 During handling of the above exception, another exception occurred: 2024-11-27T11:12:58.887590961+08:00 2024-11-27T11:12:58.887595311+08:00 Traceback (most recent call last): 2024-11-27T11:12:58.887599715+08:00 File "/app/api/core/app/apps/chat/app_generator.py", line 212, in _generate_worker 2024-11-27T11:12:58.887604030+08:00 runner.run( 2024-11-27T11:12:58.887608385+08:00 File "/app/api/core/app/apps/chat/app_runner.py", line 58, in run 2024-11-27T11:12:58.887612626+08:00 self.get_pre_calculate_rest_tokens( 2024-11-27T11:12:58.887616952+08:00 File "/app/api/core/app/apps/base_app_runner.py", line 86, in get_pre_calculate_rest_tokens 2024-11-27T11:12:58.887621484+08:00 prompt_tokens = model_instance.get_llm_num_tokens(prompt_messages) 2024-11-27T11:12:58.887625801+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_manager.py", line 154, in get_llm_num_tokens 2024-11-27T11:12:58.887635265+08:00 return self._round_robin_invoke( 2024-11-27T11:12:58.887640301+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887645291+08:00 File "/app/api/core/model_manager.py", line 310, in _round_robin_invoke 2024-11-27T11:12:58.887650662+08:00 return function(*args, **kwargs) 2024-11-27T11:12:58.887655849+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887660882+08:00 File "/app/api/core/model_runtime/model_providers/openai/llm/llm.py", line 282, in get_num_tokens 2024-11-27T11:12:58.887666187+08:00 return self._num_tokens_from_messages(base_model, prompt_messages, tools) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887676434+08:00 File "/app/api/core/model_runtime/model_providers/openai/llm/llm.py", line 1001, in _num_tokens_from_messages 2024-11-27T11:12:58.887681431+08:00 encoding = tiktoken.encoding_for_model(model) 2024-11-27T11:12:58.887686246+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/model.py", line 105, in encoding_for_model return get_encoding(encoding_name_for_model(model_name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/registry.py", line 86, in get_encoding enc = Encoding(**constructor()) 2024-11-27T11:12:58.887717266+08:00 ^^^^^^^^^^^^^ 2024-11-27T11:12:58.887722842+08:00 File "/app/api/.venv/lib/python3.12/site-packages/tiktoken_ext/openai_public.py", line 96, in o200k_base 2024-11-27T11:12:58.887727892+08:00 mergeable_ranks = load_tiktoken_bpe( ^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887738540+08:00 File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/load.py", line 144, in load_tiktoken_bpe 2024-11-27T11:12:58.887743828+08:00 contents = read_file_cached(tiktoken_bpe_file, expected_hash) 2024-11-27T11:12:58.887748830+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/load.py", line 63, in read_file_cached contents = read_file(blobpath) 2024-11-27T11:12:58.887763802+08:00 ^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887768972+08:00 File "/app/api/.venv/lib/python3.12/site-packages/tiktoken/load.py", line 24, in read_file 2024-11-27T11:12:58.887777208+08:00 resp = requests.get(blobpath) 2024-11-27T11:12:58.887782403+08:00 ^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887787086+08:00 File "/app/api/.venv/lib/python3.12/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) 2024-11-27T11:12:58.887796614+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887801564+08:00 File "/app/api/.venv/lib/python3.12/site-packages/requests/api.py", line 59, in request 2024-11-27T11:12:58.887806174+08:00 return session.request(method=method, url=url, **kwargs) 2024-11-27T11:12:58.887810869+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887815529+08:00 File "/app/api/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request 2024-11-27T11:12:58.887820192+08:00 resp = self.send(prep, **send_kwargs) 2024-11-27T11:12:58.887825159+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-11-27T11:12:58.887829683+08:00 File "/app/api/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) 2024-11-27T11:12:58.887846311+08:00 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/.venv/lib/python3.12/site-packages/requests/adapters.py", line 501, in send 2024-11-27T11:12:58.887869006+08:00 raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) 2024-11-27 03:12:58,907.907 ERROR [Dummy-11] [base_app_generate_response_converter.py:131] - ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) ``` ### ✔️ Expected Behavior Correct return ### ❌ Actual Behavior Error response
yindo added the 🐞 bug🤔 cant-reproduce labels 2026-02-21 18:18:09 -05:00
yindo closed this issue 2026-02-21 18:18:09 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Nov 26, 2024):

The error you're encountering, "Connection reset by peer," typically indicates that the connection was unexpectedly closed by the server. This can happen due to several reasons, especially after an upgrade from version 0.11.0 to 0.12.1. Here are a few potential causes and solutions:

  1. SSL Configuration: Ensure that your SSL configuration is correct. The error logs suggest issues during the SSL handshake, which might be due to incorrect SSL certificates or configurations. Verify that your SSL certificates are correctly set up and that the NGINX_HTTPS_ENABLED environment variable is configured properly if you're using HTTPS [1].

  2. Network Configuration: Check your network settings and firewall rules to ensure that there are no restrictions or blocks on the ports used by Dify. The default SSL port is 443, and it should be open and accessible.

  3. Dependencies and Libraries: Since the error involves the urllib3 and requests libraries, ensure that all dependencies are up to date and compatible with the new version. Sometimes, library updates can introduce changes that affect network connections.

  4. Retry Logic: The Dify application uses retry logic for network requests. If the connection is unstable, the retry mechanism might be triggering multiple attempts, leading to the error. Review the retry settings in your configuration to see if adjustments are needed [2].

  5. Token Calculation: The error logs also mention token calculation using the tiktoken library. Ensure that the tokenization process is correctly configured, as incorrect token counts can lead to unexpected behavior [3].

By addressing these areas, you may be able to resolve the connection issues you're experiencing after the upgrade.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Nov 26, 2024): <!-- Answer --> The error you're encountering, "Connection reset by peer," typically indicates that the connection was unexpectedly closed by the server. This can happen due to several reasons, especially after an upgrade from version 0.11.0 to 0.12.1. Here are a few potential causes and solutions: 1. **SSL Configuration**: Ensure that your SSL configuration is correct. The error logs suggest issues during the SSL handshake, which might be due to incorrect SSL certificates or configurations. Verify that your SSL certificates are correctly set up and that the `NGINX_HTTPS_ENABLED` environment variable is configured properly if you're using HTTPS <sup>[[1]](https://github.com/langgenius/dify/blob/main/docker/.env.example)</sup>. 2. **Network Configuration**: Check your network settings and firewall rules to ensure that there are no restrictions or blocks on the ports used by Dify. The default SSL port is 443, and it should be open and accessible. 3. **Dependencies and Libraries**: Since the error involves the `urllib3` and `requests` libraries, ensure that all dependencies are up to date and compatible with the new version. Sometimes, library updates can introduce changes that affect network connections. 4. **Retry Logic**: The Dify application uses retry logic for network requests. If the connection is unstable, the retry mechanism might be triggering multiple attempts, leading to the error. Review the retry settings in your configuration to see if adjustments are needed <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/helper/ssrf_proxy.py)</sup>. 5. **Token Calculation**: The error logs also mention token calculation using the `tiktoken` library. Ensure that the tokenization process is correctly configured, as incorrect token counts can lead to unexpected behavior <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/perfxcloud/llm/llm.py)</sup>. By addressing these areas, you may be able to resolve the connection issues you're experiencing after the upgrade. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@vank3f3 commented on GitHub (Nov 26, 2024):

image
My domain name is SSL signed

@vank3f3 commented on GitHub (Nov 26, 2024): ![image](https://github.com/user-attachments/assets/bc794e7f-ca32-40db-84e3-f211504bd1c8) My domain name is SSL signed
Author
Owner

@crazywoola commented on GitHub (Nov 26, 2024):

This is a general network issue.

@crazywoola commented on GitHub (Nov 26, 2024): This is a general network issue.
Author
Owner

@vank3f3 commented on GitHub (Nov 26, 2024):

How do I fix it, I didn't have this problem before I upgraded to 0.12.1

@vank3f3 commented on GitHub (Nov 26, 2024): How do I fix it, I didn't have this problem before I upgraded to 0.12.1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6965