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

Dialog failed in the wab web page #11157

Closed
5 tasks done
vank3f3 opened this issue Nov 27, 2024 · 4 comments
Closed
5 tasks done

Dialog failed in the wab web page #11157

vank3f3 opened this issue Nov 27, 2024 · 4 comments
Labels
🐞 bug Something isn't working 🤔 cant-reproduce We can not reproduce it or the information is limited

Comments

@vank3f3
Copy link

vank3f3 commented Nov 27, 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

@dosubot dosubot bot added the 🐞 bug Something isn't working label Nov 27, 2024
Copy link

dosubot bot commented Nov 27, 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.

@vank3f3
Copy link
Author

vank3f3 commented Nov 27, 2024

image
My domain name is SSL signed

@crazywoola crazywoola added the 🤔 cant-reproduce We can not reproduce it or the information is limited label Nov 27, 2024
@crazywoola
Copy link
Member

This is a general network issue.

@vank3f3
Copy link
Author

vank3f3 commented Nov 27, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🤔 cant-reproduce We can not reproduce it or the information is limited
Projects
None yet
Development

No branches or pull requests

2 participants