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

langflow 1.0.19-post1 opens and closes loads of sockets on 127.0.0.1 on startup #4263

Closed
fanimali opened this issue Oct 24, 2024 · 4 comments · Fixed by #4278
Closed

langflow 1.0.19-post1 opens and closes loads of sockets on 127.0.0.1 on startup #4263

fanimali opened this issue Oct 24, 2024 · 4 comments · Fixed by #4278
Assignees
Labels
bug Something isn't working

Comments

@fanimali
Copy link

fanimali commented Oct 24, 2024

Bug Description

Installed 1.0.19-post1. Ubuntu 22.04
when starting langflow with "langflow run", it starts binding ports 7899 on localhost:

tcp       72      0 0.0.0.0:7899            0.0.0.0:*               LISTEN
tcp      147      0 127.0.0.1:7899          127.0.0.1:59102         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:40752         CLOSE_WAIT
tcp        0      0 127.0.0.1:33816         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:48294         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60458         CLOSE_WAIT
tcp        0      0 127.0.0.1:48272         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:43736         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:33740         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:36136         CLOSE_WAIT
tcp        0      0 127.0.0.1:57234         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:36230         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60358         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:48316         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60450         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:40746         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:32798         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:48274         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:59096         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:36436         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:58416         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:46578         CLOSE_WAIT
tcp        0      0 127.0.0.1:48274         127.0.0.1:7899          FIN_WAIT2
tcp        0      0 127.0.0.1:33802         127.0.0.1:7899          FIN_WAIT2
tcp        0      0 127.0.0.1:33740         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:46582         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:45636         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:55834         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:33816         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:41770         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:59558         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60902         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:44096         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:48272         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60348         CLOSE_WAIT
tcp        0      0 127.0.0.1:33728         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:41194         CLOSE_WAIT
tcp        0      0 127.0.0.1:57220         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:40388         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:36240         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:56040         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:55734         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:45560         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:48306         CLOSE_WAIT
tcp        0      0 127.0.0.1:36240         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:36232         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:32808         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:41208         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:56044         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:44486         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:54610         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:57220         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:44112         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:58412         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:38254         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:54908         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:59544         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:53778         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:58748         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:47800         CLOSE_WAIT
tcp        0      0 127.0.0.1:41770         127.0.0.1:7899          FIN_WAIT2
tcp      147      0 127.0.0.1:7899          127.0.0.1:45646         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:53296         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60912         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:33802         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:36684         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:57234         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:36128         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60262         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:45478         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:48326         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:47794         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:33728         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:44494         CLOSE_WAIT
tcp        0      0 127.0.0.1:34818         127.0.0.1:7899          ESTABLISHED
tcp      147      0 127.0.0.1:7899          127.0.0.1:37044         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:45576         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:59656         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:60278         CLOSE_WAIT
tcp      146      0 127.0.0.1:7899          127.0.0.1:34818         ESTABLISHED
tcp      147      0 127.0.0.1:7899          127.0.0.1:54608         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:36862         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:43720         CLOSE_WAIT
tcp      147      0 127.0.0.1:7899          127.0.0.1:45468         CLOSE_WAIT

Langflow loops in this way for 10 minutes:

$ date ;langflow run
Thu Oct 24 07:39:29 UTC 2024
Starting Langflow v1.0.19.post1...

[10/24/24 07:49:00] ERROR    2024-10-24 07:49:00 - ERROR    - directory_reader - Error while getting output types from code          directory_reader.py:350
                             Traceback (most recent call last):

but even if it seems to be started, it keeps binding to the 7899 port:

-----------------NETSTAT 7899---------------------
---------------Thu Oct 24 08:01:43 UTC 2024-------------
netstat -an|grep 7899|wc -l
240

after more than 20 minutes, langflow has not yet started and continues to open and close ports 7899 on localhost

Reproduction

install langflow 1.0.19-post1 on ubuntu 22 aws instance m4.4xlarge, on python 3.12.7.

run langflow for the first time and create a flow DocumentQA.
Replace the initial File plugin with a Directory plugin and read from a directory where there is a single text file.

Expected behavior

langflow should start in a matter of less than a minute and it should show the existing projects.

Who can help?

@ogabrielluiz

Operating System

Ubuntu 22.04

Langflow Version

1.0.19-post1

Python Version

3.12

Screenshot

watching netstat:
image

langflow tries to startup:
image

langflow19-post1-startup-failure.txt

Flow File

No response

@fanimali fanimali added the bug Something isn't working label Oct 24, 2024
Copy link

dosubot bot commented Oct 24, 2024

Hello @fanimali! I'm a bot designed to help you solve bugs, answer questions, and become a contributor. I'm here to assist you while waiting for a human maintainer.

The issue you're experiencing with Langflow version 1.0.19-post1, where it repeatedly opens and closes sockets on port 7899 during startup, could be related to how Langflow manages socket connections and handles errors. Here are a few things to consider:

  1. Socket Management: Langflow uses a SocketIOService to manage socket connections. It initializes and manages connections, handling events like connection and disconnection. If there are issues with how these connections are managed, it could lead to excessive opening and closing of sockets [1][2].

  2. Error Logging: Langflow logs exceptions during startup, which can help identify issues. The error in the directory_reader module suggests there might be a problem with reading or processing directory contents, which could be affecting the startup process [3].

  3. Port Usage Check: Langflow checks if a port is in use with the is_port_in_use function. If the port is already in use or if there are issues with binding to the port, it could cause repeated attempts to open and close connections [3].

To address this issue, you might want to:

  • Check for Conflicting Services: Ensure no other services are using port 7899.
  • Review Error Logs: Look into the detailed error logs to identify specific issues in the directory_reader module.
  • Modify Configurations: If possible, try modifying the default port or socket configurations to see if it alleviates the issue.

If these steps do not resolve the problem, further investigation into the specific error messages and the directory_reader module might be necessary.

To continue talking to Dosu, mention @dosu.

@fanimali
Copy link
Author

fanimali commented Oct 24, 2024

i found out that the langflow.db is very large:

-rw-r--r--  1 automaton automaton 605995008 Oct 24 06:44 langflow.db
-rw-r--r--  1 automaton automaton     32768 Oct 24 07:39 langflow.db-shm
-rw-r--r--  1 automaton automaton         0 Oct 24 06:47 langflow.db-wal

i wil ltry to refresh it:

i have truncated the vertex_build table and also added these two variables to langflow env:

export LANGFLOW_VERTEX_BUILDS_STORAGE_ENABLED=false
export LANGFLOW_TRANSACTIONS_STORAGE_ENABLED=false

and trying to start langflow again but it is still taking ages to startup and still opening and closing new sockets...

@ogabrielluiz ogabrielluiz self-assigned this Oct 24, 2024
@ogabrielluiz
Copy link
Contributor

Hey @fanimali

We'll start investigating here as well. Keep the info coming and thanks for the help!

@cbornet
Copy link
Collaborator

cbornet commented Oct 24, 2024

The problem is that astra-assistants has e2b-code-interpreter as optional dependency but doesn't constrain its version.
And there was a breaking change in e2b-code-interpreter last week (legit as it's a major version change).
The quick workaround is to pin versions e2b<1 e2b-code-interpreter<1.
@fanimali how did you install langflow ?
If it's with pip, try pip install "e2b<1" "e2b-code-interpreter<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
Projects
None yet
3 participants