Error description
If the set port number is less than 1000, an error will be reported, and there is no permission
2022-03-29T10:23:16.651636+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-29T10:23:28.994173+00:00 heroku[web.1]: Starting process with command `python /code/server3.py`
2022-03-29T10:23:30.091143+00:00 app[web.1]: Traceback (most recent call last):
2022-03-29T10:23:30.091204+00:00 app[web.1]: File "/code/server3.py", line 247, in <module>
2022-03-29T10:23:30.091205+00:00 app[web.1]: serverSocket.bind(("127.0.0.1", serverPort))
2022-03-29T10:23:30.091208+00:00 app[web.1]: PermissionError: [Errno 13] Permission denied
2022-03-29T10:23:30.234919+00:00 heroku[web.1]: Process exited with status 1
2022-03-29T10:23:30.279569+00:00 heroku[web.1]: State changed from starting to crashed
If you set the port number to 8080, you will not be connected within 60 seconds
2022-03-29T10:53:34.400924+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-29T10:53:49.432473+00:00 heroku[web.1]: Starting process with command `python /code/server3.py`
2022-03-29T10:53:33.432308+00:00 app[api]: Release v9 created by user ***@icloud.com
2022-03-29T10:53:33.432308+00:00 app[api]: Deployed web (350d1bd5740a) by user ***@icloud.com
2022-03-29T10:54:49.500818+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-03-29T10:54:49.587777+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-03-29T10:54:49.800462+00:00 heroku[web.1]: Process exited with status 137
If the port number in the environment variable is referenced dynamically, the acquisition fails
2022-03-29T11:12:03.984493+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-29T11:12:19.984320+00:00 heroku[web.1]: Starting process with command `python /code/server3.py`
2022-03-29T11:12:21.706887+00:00 heroku[web.1]: Process exited with status 1
2022-03-29T11:12:21.536737+00:00 app[web.1]: Traceback (most recent call last):
2022-03-29T11:12:21.536756+00:00 app[web.1]: File "/code/server3.py", line 248, in <module>
2022-03-29T11:12:21.536757+00:00 app[web.1]: serverSocket.bind(("0.0.0.0", serverPort))
2022-03-29T11:12:21.536757+00:00 app[web.1]: TypeError: an integer is required (got type NoneType)
2022-03-29T11:12:21.769096+00:00 heroku[web.1]: State changed from starting to crashed
No matter the local address is not written,
ServerSocket Bind ((“”, serverport))
or 127.0.0.1
ServerSocket Bind ((“127.0.0.1”, serverport))
or write 0.0.0
ServerSocket Bind ((“0.0.0.0”, serverport))
doesn’t work
Solution (Python Project):
Dynamic binding port number is required
To write this in dockerfile, pass in $post
#Base image based on
FROM python:3.4
#code added to code folder
ADD . /pythonProject /code
# Set the code folder to be the working directory
WORKDIR /code
# Install support
#RUN pip install -r requirements.txt
CMD python /code/server3.py $PORT
Python file writing format, obtain through parameters in server.py
serverPort = int(sys.argv[1])
The complete structure is as follows
if __name__ == '__main__':
serverSocket = socket(AF_INET, SOCK_STREAM)
serverPort = int(sys.argv[1])
serverSocket.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
serverSocket.bind(("", serverPort))
serverSocket.listen(5)
print('The server is running')
# Main web server loop. It simply accepts TCP connections, and get the request processed in seperate threads.
while True:
# Set up a new connection from the client
connectionSocket, addr = serverSocket.accept()
# Clients timeout after 60 seconds of inactivity and must reconnect.
connectionSocket.settimeout(600)
# start new thread to handle incoming request
_thread.start_new_thread(process, (connectionSocket,))
Solution (Nodejs Project):
// production
config.port = process.env.PORT
app.listen(config.port, () => {
logger.info('Listening on port %d', config.port);
});
or
.listen(process.env.PORT || 5000)
or
production: {
server: {
host: '0.0.0.0',
port: process.env.PORT
}
}
Read More:
- [Solved] Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563;Error creating bean
- [Solved] Web server failed to start. Port 8080 was already in use.
- [Solved] SpringBoot Startup Error: Description:Web server failed to start. Port 9090 was already in use.(win10)
- Resin Failed to Startup Error: ERROR: transport error 202: bind failed: Address already in use: JVM_Bind Listenin (Two Resins in One PC)
- cuda_error_launch_failed: unspecified launch failure [How to Solve]
- [Solved] Failed to bind properties under ‘spring.servlet.multipart.file-size-threshold‘ to
- [Solved] Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerExcepti
- [Solved] eureka Startup Error: Unable to start web … nested exception is org.springframework.boot.web.server.WebS
- [Solved] eureka Startup Error: Unable to start web … nested exception is org.springframework.boot.web.server.WebS
- [Solved] JAVA Web Error: startup failed due to previous errors
- [Solved] ERROR: child process failed, exited with error number 100To see additional information in this …
- mybatis “case when” Error: Failed to process, please exclude the tableName or statementId.
- Android studio compilation failed: java.util.concurrent.ExecutionException: com.android.ide.common.process.Process
- [Solved] port (127.0.0.1:64444): java.net.SocketException “Interrupted function call: accept failed“
- Error resolution: Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/Datatype
- [Solved] JSONUtil.toJsonStr() Error: org.springframework.web.util.NestedServletException: Handler dispatch failed…
- JAVA: How to Read JSON Format Data (Web Game Development)
- [Solved] org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is
- [Solved] Upload Files Error: Request processing failed;nested exception is org.springframework.web.multipart.MultipartExcepti
- [Solved] Windows Redis Error: Could not create server TCP listening socket 127.0.0.1:6379: bind…