No, the Operating System (Linux) will not send a TCP RST packet immediately when an application that establishes a TCP connection panics.
When an application panics, the operating system will first try to terminate the application gracefully. This means that the operating system will send a SIGTERM signal to the application and wait for the application to exit. If the application does not exit within a certain amount of time, the operating system will send a SIGKILL signal to the application, which will force the application to terminate.
Only after the application has been terminated will the operating system close the TCP connection and send a TCP RST packet to the remote end.
The reason why the operating system does not send a TCP RST packet immediately is to give the application a chance to clean up its resources and exit gracefully. This helps to prevent data corruption and other problems that can occur if an application is terminated abruptly.
However, if the application is unable to recover from the panic and is unresponsive to SIGTERM and SIGKILL signals, the operating system will eventually send a TCP RST packet to the remote end. This will happen after the operating system has waited a certain amount of time for the application to respond.
The amount of time that the operating system waits before sending a TCP RST packet can vary depending on the operating system and the application. However, it is typically a few seconds.
So, to answer your question, the operating system will not send a TCP RST packet immediately when an application that establishes a TCP connection panics. It will first try to terminate the application gracefully and only send a TCP RST packet if the application is unresponsive or unable to recover from the panic.