TransformerOptimus / SuperAGI

<⚡️> SuperAGI - A dev-first open source autonomous AI agent framework. Enabling developers to build, manage & run useful autonomous agents quickly and reliably.
https://superagi.com/
MIT License
15.26k stars 1.83k forks source link

Segmentation fault superagi-gui #195

Closed gpilleux closed 11 months ago

gpilleux commented 1 year ago

I just pulled the project like an hour ago and been trying to solve the issues that have been showing up. First this user I had this user error

 /usr/local/lib/python3.9/site-packages/celery/platforms.py:840: SecurityWarning: You're running the worker with superuser privileges: this is
superagi-celery-1           | absolutely not recommended!
superagi-celery-1           | 
superagi-celery-1           | Please specify a different user using the --uid option.

which was fixed by adding this lines to DockerfileCelery

RUN groupadd -g 999 nonrootgroup
RUN useradd -u 501 -g 999 -M nonrootuser
USER nonrootuser

This is the complete log after executing docker-compose up --build

2023-06-06 02:20:01 superagi-super__redis-1     | 1:C 06 Jun 2023 06:20:01.360 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2023-06-06 02:20:01 superagi-super__redis-1     | 1:C 06 Jun 2023 06:20:01.360 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started
2023-06-06 02:20:01 superagi-super__redis-1     | 1:C 06 Jun 2023 06:20:01.360 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2023-06-06 02:20:01 superagi-super__redis-1     | 1:M 06 Jun 2023 06:20:01.365 * monotonic clock: POSIX clock_gettime
2023-06-06 02:20:01 superagi-super__redis-1     | 1:M 06 Jun 2023 06:20:01.367 * Running mode=standalone, port=6379.
2023-06-06 02:20:01 superagi-super__redis-1     | 1:M 06 Jun 2023 06:20:01.369 # Server initialized
2023-06-06 02:20:01 superagi-super__redis-1     | 1:M 06 Jun 2023 06:20:01.371 * Ready to accept connections
2023-06-06 02:20:01 superagi-super__postgres-1  | 
2023-06-06 02:20:01 superagi-super__postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-06-06 02:20:01 superagi-super__postgres-1  | 
2023-06-06 02:20:01 superagi-super__postgres-1  | 2023-06-06 06:20:01.636 UTC [1] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-06-06 02:20:01 superagi-super__postgres-1  | 2023-06-06 06:20:01.637 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-06-06 02:20:01 superagi-super__postgres-1  | 2023-06-06 06:20:01.637 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-06-06 02:20:01 superagi-super__postgres-1  | 2023-06-06 06:20:01.649 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-06-06 02:20:01 superagi-super__postgres-1  | 2023-06-06 06:20:01.673 UTC [29] LOG:  database system was shut down at 2023-06-06 06:19:41 UTC
2023-06-06 02:20:01 superagi-super__postgres-1  | 2023-06-06 06:20:01.693 UTC [1] LOG:  database system is ready to accept connections
2023-06-06 02:20:03 superagi-celery-1           | Connected to the database! @ postgresql://superagi:password@super__postgres/super_agi_main
2023-06-06 02:20:06 superagi-celery-1           |  
2023-06-06 02:20:06 superagi-celery-1           |  -------------- celery@e67c16ab4adb v5.2.7 (dawn-chorus)
2023-06-06 02:20:06 superagi-celery-1           | --- ***** ----- 
2023-06-06 02:20:06 superagi-celery-1           | -- ******* ---- Linux-5.15.49-linuxkit-x86_64-with-glibc2.31 2023-06-06 06:20:06
2023-06-06 02:20:06 superagi-celery-1           | - *** --- * --- 
2023-06-06 02:20:06 superagi-celery-1           | - ** ---------- [config]
2023-06-06 02:20:06 superagi-celery-1           | - ** ---------- .> app:         superagi:0x7f7e27eafee0
2023-06-06 02:20:06 superagi-celery-1           | - ** ---------- .> transport:   redis://super__redis:6379/0
2023-06-06 02:20:06 superagi-celery-1           | - ** ---------- .> results:     redis://super__redis:6379/0
2023-06-06 02:20:06 superagi-celery-1           | - *** --- * --- .> concurrency: 10 (prefork)
2023-06-06 02:20:06 superagi-celery-1           | -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
2023-06-06 02:20:06 superagi-celery-1           | --- ***** ----- 
2023-06-06 02:20:06 superagi-celery-1           |  -------------- [queues]
2023-06-06 02:20:06 superagi-celery-1           |                 .> celery           exchange=celery(direct) key=celery
2023-06-06 02:20:06 superagi-celery-1           |                 
2023-06-06 02:20:06 superagi-celery-1           | 
2023-06-06 02:20:06 superagi-celery-1           | [tasks]
2023-06-06 02:20:06 superagi-celery-1           |   . execute_agent
2023-06-06 02:20:06 superagi-celery-1           | 
2023-06-06 02:20:07 superagi-celery-1           | [2023-06-06 06:20:07,522: INFO/MainProcess] Connected to redis://super__redis:6379/0
2023-06-06 02:20:07 superagi-celery-1           | [2023-06-06 06:20:07,533: INFO/MainProcess] mingle: searching for neighbors
2023-06-06 02:20:08 superagi-celery-1           | [2023-06-06 06:20:08,551: INFO/MainProcess] mingle: all alone
2023-06-06 02:20:08 superagi-celery-1           | [2023-06-06 06:20:08,570: INFO/MainProcess] celery@e67c16ab4adb ready.
2023-06-06 02:20:02 superagi-gui-1              | 
2023-06-06 02:20:02 superagi-gui-1              | > super-agi@0.1.0 dev
2023-06-06 02:20:02 superagi-gui-1              | > next dev
2023-06-06 02:20:02 superagi-gui-1              | 
2023-06-06 02:20:03 superagi-gui-1              | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
2023-06-06 02:20:03 superagi-gui-1              | - warn Invalid next.config.js options detected: 
2023-06-06 02:20:03 superagi-gui-1              | - warn     The root value has an unexpected property, webpackDevMiddleware, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, configOrigin, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, target, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
2023-06-06 02:20:03 superagi-gui-1              | - warn See more info here: https://nextjs.org/docs/messages/invalid-next-config
2023-06-06 02:20:04 superagi-gui-1              | Attention: Next.js now collects completely anonymous telemetry regarding usage.
2023-06-06 02:20:04 superagi-gui-1              | This information is used to shape Next.js' roadmap and prioritize features.
2023-06-06 02:20:04 superagi-gui-1              | You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
2023-06-06 02:20:04 superagi-gui-1              | https://nextjs.org/telemetry
2023-06-06 02:20:04 superagi-gui-1              | 
2023-06-06 02:20:02 superagi-backend-1          | wait-for-it.sh: waiting 60 seconds for super__postgres:5432
2023-06-06 02:20:02 superagi-backend-1          | wait-for-it.sh: super__postgres:5432 is available after 0 seconds
2023-06-06 02:20:03 superagi-backend-1          | INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
2023-06-06 02:20:03 superagi-backend-1          | INFO  [alembic.runtime.migration] Will assume transactional DDL.
2023-06-06 02:20:03 superagi-backend-1          | INFO:     Will watch for changes in these directories: ['/app']
2023-06-06 02:20:03 superagi-backend-1          | INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
2023-06-06 02:20:03 superagi-backend-1          | INFO:     Started reloader process [1] using WatchFiles
2023-06-06 02:20:05 superagi-backend-1          | Connected to the database! @ postgresql://superagi:password@super__postgres/super_agi_main
2023-06-06 02:20:07 superagi-backend-1          | INFO:     Started server process [20]
2023-06-06 02:20:07 superagi-backend-1          | INFO:     Waiting for application startup.
2023-06-06 02:20:07 superagi-backend-1          | INFO:     Application startup complete.

Only thing I can see that looks wierd is that - warn Invalid next.config.js options detected:. Anyways, the only container that wasn't running was the superagi-gui-1 and by clicking the play button to execute it, this log comes up

2023-06-06 02:26:27 superagi-gui-1              | 
2023-06-06 02:26:27 superagi-gui-1              | > super-agi@0.1.0 dev
2023-06-06 02:26:27 superagi-gui-1              | > next dev
2023-06-06 02:26:27 superagi-gui-1              | 
2023-06-06 02:26:27 superagi-gui-1              | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
2023-06-06 02:26:28 superagi-gui-1              | Segmentation fault
1969-12-31 21:00:00 superagi-gui-1 exited with code 139

Any ideas why this is happening? My machine is a macOS Ventura 13.4

Fluder-Paradyne commented 1 year ago

replace your next.config.js with this `/* @type {import('next').NextConfig} / const nextConfig = { assetPrefix: process.env.NODE_ENV === "production" ? "/" : "./", // webpackDevMiddleware: config => { // config.watchOptions = { // poll: 1000, // aggregateTimeout: 300, // } // return config // } }

module.exports = nextConfig `

Fluder-Paradyne commented 1 year ago

I basically commented out the webpackDevMiddleware options I added that config because the in windows next.js was unable to detect code changes when developing. try removing it and check

gpilleux commented 1 year ago

Hi Fluder, thanks for answering. I commented out the lines you showed in the next.config.js file and the gui container is answering with the same segmentation fault log as shown above.

gpilleux commented 1 year ago

I am using the Pinecone free plan and thanks to this issue I managed to setup the workaround for it.

Now the gui container is not showing segmentation fault but it is still exiting with code 1.

I tried downloading the release version0.0.2 and running docker-compose up --build is showing segmentation fault for the gui container.

gpilleux commented 1 year ago

I left all 4 containers running and after a while I tried to restart the gui container and segmentation fault is back 😢

2023-06-06 12:01:06 superagi-gui-1              | 
2023-06-06 12:01:06 superagi-gui-1              | > super-agi@0.1.0 dev
2023-06-06 12:01:06 superagi-gui-1              | > next dev
2023-06-06 12:01:06 superagi-gui-1              | 
2023-06-06 12:01:07 superagi-gui-1              | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
2023-06-06 12:01:07 superagi-gui-1              | Segmentation fault
1969-12-31 21:00:00 superagi-gui-1 exited with code 139
Fluder-Paradyne commented 1 year ago

can u try with the latest main

luciferlinx101 commented 1 year ago

@gpilleux can you try downloading/cloning the latest code in main branch instead of the release

gpilleux commented 1 year ago

All the executions have been with the latest main (except this one time with the release verison 0.0.2). I have pulled the latest main branch and still getting Segmentation Fault

2023-06-06 15:26:56 superagi-backend-1          | wait-for-it.sh: waiting 60 seconds for super__postgres:5432
2023-06-06 15:26:56 superagi-backend-1          | wait-for-it.sh: super__postgres:5432 is available after 0 seconds
2023-06-06 15:27:01 superagi-backend-1          | INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
2023-06-06 15:27:01 superagi-backend-1          | INFO  [alembic.runtime.migration] Will assume transactional DDL.
2023-06-06 15:27:03 superagi-backend-1          | INFO:     Will watch for changes in these directories: ['/app']
2023-06-06 15:27:03 superagi-backend-1          | INFO:     Uvicorn running on http://0.0.0.0:8001 (Press CTRL+C to quit)
2023-06-06 15:27:03 superagi-backend-1          | INFO:     Started reloader process [1] using WatchFiles
2023-06-06 15:27:10 superagi-backend-1          | Connected to the database! @ postgresql://superagi:password@super__postgres/super_agi_main
2023-06-06 15:27:19 superagi-backend-1          | INFO:     Started server process [20]
2023-06-06 15:27:19 superagi-backend-1          | INFO:     Waiting for application startup.
2023-06-06 15:27:19 superagi-backend-1          | INFO:     Application startup complete.
2023-06-06 15:26:57 superagi-gui-1              | 
2023-06-06 15:26:57 superagi-gui-1              | > super-agi@0.1.0 dev
2023-06-06 15:26:57 superagi-gui-1              | > next dev
2023-06-06 15:26:57 superagi-gui-1              | 
------> **2023-06-06 15:26:58 superagi-gui-1              | Segmentation fault** <--------
2023-06-06 15:27:04 superagi-celery-1           | Connected to the database! @ postgresql://superagi:password@super__postgres/super_agi_main
2023-06-06 15:27:13 superagi-celery-1           |  
2023-06-06 15:27:13 superagi-celery-1           |  -------------- celery@d0163640b931 v5.2.7 (dawn-chorus)
2023-06-06 15:27:13 superagi-celery-1           | --- ***** ----- 
2023-06-06 15:27:13 superagi-celery-1           | -- ******* ---- Linux-5.15.49-linuxkit-x86_64-with-glibc2.31 2023-06-06 19:27:13
2023-06-06 15:27:13 superagi-celery-1           | - *** --- * --- 
2023-06-06 15:27:13 superagi-celery-1           | - ** ---------- [config]
2023-06-06 15:27:13 superagi-celery-1           | - ** ---------- .> app:         superagi:0x7f22e26a5040
2023-06-06 15:27:13 superagi-celery-1           | - ** ---------- .> transport:   redis://super__redis:6379/0
2023-06-06 15:27:13 superagi-celery-1           | - ** ---------- .> results:     redis://super__redis:6379/0
2023-06-06 15:27:13 superagi-celery-1           | - *** --- * --- .> concurrency: 10 (prefork)
2023-06-06 15:27:13 superagi-celery-1           | -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
2023-06-06 15:27:13 superagi-celery-1           | --- ***** ----- 
2023-06-06 15:27:13 superagi-celery-1           |  -------------- [queues]
2023-06-06 15:27:13 superagi-celery-1           |                 .> celery           exchange=celery(direct) key=celery
2023-06-06 15:27:13 superagi-celery-1           |                 
2023-06-06 15:27:13 superagi-celery-1           | 
2023-06-06 15:27:13 superagi-celery-1           | [tasks]
2023-06-06 15:27:13 superagi-celery-1           |   . execute_agent
2023-06-06 15:27:13 superagi-celery-1           | 
2023-06-06 15:27:16 superagi-celery-1           | [2023-06-06 19:27:16,831: INFO/MainProcess] Connected to redis://super__redis:6379/0
2023-06-06 15:27:16 superagi-celery-1           | [2023-06-06 19:27:16,900: INFO/MainProcess] mingle: searching for neighbors
2023-06-06 15:27:17 superagi-celery-1           | [2023-06-06 19:27:17,993: INFO/MainProcess] mingle: all alone
2023-06-06 15:27:18 superagi-celery-1           | [2023-06-06 19:27:18,090: INFO/MainProcess] celery@d0163640b931 ready.
2023-06-06 15:26:54 superagi-super__redis-1     | 1:C 06 Jun 2023 19:26:54.393 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
2023-06-06 15:26:54 superagi-super__redis-1     | 1:C 06 Jun 2023 19:26:54.394 # Redis version=7.0.11, bits=64, commit=00000000, modified=0, pid=1, just started
2023-06-06 15:26:54 superagi-super__redis-1     | 1:C 06 Jun 2023 19:26:54.394 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
2023-06-06 15:26:54 superagi-super__redis-1     | 1:M 06 Jun 2023 19:26:54.396 * monotonic clock: POSIX clock_gettime
2023-06-06 15:26:54 superagi-super__redis-1     | 1:M 06 Jun 2023 19:26:54.412 * Running mode=standalone, port=6379.
2023-06-06 15:26:54 superagi-super__redis-1     | 1:M 06 Jun 2023 19:26:54.412 # Server initialized
2023-06-06 15:26:54 superagi-super__redis-1     | 1:M 06 Jun 2023 19:26:54.419 * Ready to accept connections
2023-06-06 15:26:54 superagi-super__postgres-1  | 
2023-06-06 15:26:54 superagi-super__postgres-1  | PostgreSQL Database directory appears to contain a database; Skipping initialization
2023-06-06 15:26:54 superagi-super__postgres-1  | 
2023-06-06 15:26:54 superagi-super__postgres-1  | 2023-06-06 19:26:54.598 UTC [1] LOG:  starting PostgreSQL 15.3 (Debian 15.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2023-06-06 15:26:54 superagi-super__postgres-1  | 2023-06-06 19:26:54.600 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-06-06 15:26:54 superagi-super__postgres-1  | 2023-06-06 19:26:54.600 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2023-06-06 15:26:54 superagi-super__postgres-1  | 2023-06-06 19:26:54.612 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-06-06 15:26:54 superagi-super__postgres-1  | 2023-06-06 19:26:54.640 UTC [29] LOG:  database system was interrupted; last known up at 2023-06-06 19:26:14 UTC
2023-06-06 15:26:55 superagi-super__postgres-1  | 2023-06-06 19:26:55.354 UTC [29] LOG:  database system was not properly shut down; automatic recovery in progress
2023-06-06 15:26:55 superagi-super__postgres-1  | 2023-06-06 19:26:55.361 UTC [29] LOG:  invalid record length at 0/19BCCD0: wanted 24, got 0
2023-06-06 15:26:55 superagi-super__postgres-1  | 2023-06-06 19:26:55.361 UTC [29] LOG:  redo is not required
2023-06-06 15:26:55 superagi-super__postgres-1  | 2023-06-06 19:26:55.377 UTC [27] LOG:  checkpoint starting: end-of-recovery immediate wait
2023-06-06 15:26:55 superagi-super__postgres-1  | 2023-06-06 19:26:55.401 UTC [27] LOG:  checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.007 s, sync=0.003 s, total=0.029 s; sync files=2, longest=0.002 s, average=0.002 s; distance=0 kB, estimate=0 kB
2023-06-06 15:26:55 superagi-super__postgres-1  | 2023-06-06 19:26:55.416 UTC [1] LOG:  database system is ready to accept connections

This is the complete log of docker-compose up --build with the highlighted superagi-gui error.

If I explicitly run the superagi-gui-1 container this is the log

2023-06-06 15:33:25 superagi-gui-1              | 
2023-06-06 15:33:25 superagi-gui-1              | > super-agi@0.1.0 dev
2023-06-06 15:33:25 superagi-gui-1              | > next dev
2023-06-06 15:33:25 superagi-gui-1              | 
2023-06-06 15:33:25 superagi-gui-1              | - ready started server on 0.0.0.0:3000, url: http://localhost:3000
2023-06-06 15:33:25 superagi-gui-1              | Segmentation fault
1969-12-31 21:00:00 superagi-gui-1 exited with code 139
Fluder-Paradyne commented 1 year ago

can you give your computer spec

try this out

once the error occurs

install node if you dont have it

then do

  1. npm install
  2. npm run dev

if you already have a node modules folder delete it first

nborthy commented 1 year ago

try replacing your next.config.js with the following:

/* @type {import('next').NextConfig} / const nextConfig = { assetPrefix: process.env.NODE_ENV === "production" ? "/" : "./", webpack: config => { config.watchOptions = { poll: 1000, aggregateTimeout: 300, }; return config; }, };

module.exports = nextConfig;

after making this change kindly restart the container

gpilleux commented 1 year ago

So I ran a bash shell on the container and you can see that npm is installed and up to date. Segmentation fault visible after second npm run dev command. Couldn't fetch localhost:3000 on either execution. How can I look for more specific logs?

Segmentation Fault

Aren't you seeing this same error? Why would my OS have anything to do on this container being executed? I have a Macbook Pro 2020 running on Ventura 13.4.

Fluder-Paradyne commented 1 year ago

I tried in mac didn't get the error can you increase the amount of resource the docker desktop is provided you can change it in docker desktop setting under resources

image

gpilleux commented 1 year ago

I have those exact same settings on the Docker Desktop. Since I don't know how else to debug this, I deleted the project and cloned the repo from scratch. Only change made was renaming config_template.yaml to config.yaml and didn't touch any of the code. Running docker-compose up --build gives me the exact same log as previously. Really strange. Am I missing some configuration which might cause this segmentation fault?

Screenshot 2023-06-08 at 02 07 05
gpilleux commented 1 year ago

Now I cloned the repo on an ubuntu machine and the gui is running fine! I'm really confused as to why this isn't working on my macOS... but oh well, will be using it on the Ubuntu where is doesn't have any problems. Thanks so much for the support, keep it up!

kcverde commented 1 year ago

I'm having the exact same issue (Intel macOS). I wonder if it is an issue with docker on macOS on intel?

kcverde commented 1 year ago

I solved it: Docker Settings->Uncheck Virtualization Framework and used system default container terminal and legacy file system. Not sure which one fixed it. But was excited to share the update.

gpilleux commented 1 year ago

This actually solves it. So much thanks @kcverde !!

erkkimon commented 1 year ago

I also can confirm that disabling "Use Virtualization framework" in Settings does the magic. Thanks @kcverde for sharing your observation, it really did save my and many others' day!

I didn't change "Container terminal" option, which is "Integrated" in my Settings and it works. Neither did I change "Legacy file system" option, and the GUI works.

Can we enforce this container setting somehow? It would be nice to have that setting in right condition for everyone who clones the repo and builds the container. Quite many seem to run into this exact problem. As a workaround and quick fix, we could update it in the README.

But, do we have a config level solution for this so that it would work just like magic?

neelayan7 commented 1 year ago

Is this issue still persisting in the newer version releases? @gpilleux

am0oma commented 1 year ago

I solved it: Docker Settings->Uncheck Virtualization Framework and used system default container terminal and legacy file system. Not sure which one fixed it. But was excited to share the update.

Thank you a lot, finally, it solved on intel macOS