Skip to content

flake: TestServer/EphemeralDeployment: address already in use #658

Open
@dannykopping

Description

@dannykopping

Different issue seen here:

=== FAIL: cli TestServer/EphemeralDeployment (unknown)
    clitest.go:75: invoking command: coder --global-config /tmp/TestServerEphemeralDeployment2857166677/001 server --http-address :0 --access-url http://example.com/ --ephemeral
    ptytest.go:132: 2025-06-02 20:57:54.455: cmd: "Started HTTP listener at http://[::]:36265"
    ptytest.go:132: 2025-06-02 20:57:54.455: cmd: "Using an ephemeral deployment directory (/tmp/coder_ephemeral_1748897874455)\r"
    ptytest.go:132: 2025-06-02 20:57:54.455: cmd: "Using built-in PostgreSQL (/tmp/coder_ephemeral_1748897874455/postgres)\r"
    ptytest.go:167: 2025-06-02 20:57:54.456: cmd: matched "Using an ephemeral deployment directory" = "Started HTTP listener at http://[::]:36265\r\nUsing an ephemeral deployment directory"
    server_test.go:215: 2025-06-02 20:57:54.456: cmd: matched newline = " (/tmp/coder_ephemeral_1748897874455)"
    ptytest.go:132: 2025-06-02 20:57:59.637: cmd: "Removing ephemeral deployment directory...\r"
    ptytest.go:132: 2025-06-02 20:57:59.679: cmd: "Removed ephemeral deployment directory\r"
    server_test.go:230: 
        	Error Trace:	/home/runner/work/coder/coder/cli/server_test.go:230
        	Error:      	Received unexpected error:
        	            	running command "coder server": Failed to start built-in PostgreSQL. Optionally, specify an external deployment with `--postgres-url`:
        	            	    github.com/coder/coder/v2/cli.startBuiltinPostgres
        	            	        /home/runner/work/coder/coder/cli/server.go:2205
        	            	  - could not start postgres using /tmp/coder_ephemeral_1748897874455/postgres/bin/bin/pg_ctl start -w -D /tmp/coder_ephemeral_1748897874455/postgres/data -o -p 36629:
        	            	The files belonging to this database system will be owned by user "runner".
        	            	This user must also own the server process.
        	            	
        	            	The database cluster will be initialized with locale "en_US.UTF-8".
        	            	The default text search configuration will be set to "english".
        	            	
        	            	Data page checksums are disabled.
        	            	
        	            	creating directory /tmp/coder_ephemeral_1748[8978](https://github.com/coder/coder/actions/runs/15402599063/job/43338538726#step:13:8979)74455/postgres/data ... ok
        	            	creating subdirectories ... ok
        	            	selecting dynamic shared memory implementation ... posix
        	            	selecting default max_connections ... 100
        	            	selecting default shared_buffers ... 128MB
        	            	selecting default time zone ... Etc/UTC
        	            	creating configuration files ... ok
        	            	running bootstrap script ... ok
        	            	performing post-bootstrap initialization ... ok
        	            	syncing data to disk ... ok
        	            	
        	            	Success. You can now start the database server using:
        	            	
        	            	    /tmp/coder_ephemeral_1748897874455/postgres/bin/bin/pg_ctl -D /tmp/coder_ephemeral_1748897874455/postgres/data -l logfile start
        	            	
        	            	waiting for server to start....2025-06-02 20:57:59.585 UTC [31558] LOG:  starting PostgreSQL 13.16 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
        	            	2025-06-02 20:57:59.585 UTC [31558] LOG:  could not bind IPv6 address "::1": Address already in use
        	            	2025-06-02 20:57:59.585 UTC [31558] HINT:  Is another postmaster already running on port 36629? If not, wait a few seconds and retry.
        	            	2025-06-02 20:57:59.585 UTC [31558] LOG:  could not bind IPv4 address "127.0.0.1": Address already in use
        	            	2025-06-02 20:57:59.585 UTC [31558] HINT:  Is another postmaster already running on port 36629? If not, wait a few seconds and retry.
        	            	2025-06-02 20:57:59.585 UTC [31558] WARNING:  could not create listen socket for "localhost"
        	            	2025-06-02 20:57:59.585 UTC [31558] FATAL:  could not create any TCP/IP sockets
        	            	2025-06-02 20:57:59.587 UTC [31558] LOG:  database system is shut down
        	            	 stopped waiting
        	            	pg_ctl: could not start server
        	            	Examine the log output.
        	Test:       	TestServer/EphemeralDeployment

Originally posted by @dannykopping in #549

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions