Open AhmedWaleedAhmed opened 2 years ago
I don't know that there's a way for us to know if the work in unsubscribe has finished, would moving that transaction into a job system like active job work?
I think moving it will work but will not solve the issue completely because if we failed to enqueue a job for any reason before the process gets killed we will also have the same issue.
I don't know if this can be done or not but if there is a way to trap the killing signal until the process is finished the transaction. this will eliminate the problem.
Question 1: What is the problem?
When Passenger process in a shutdown mode and we have our last session and this session dies when we have a big transaction like (5 sec) in the unsubscribe method to be done after the session is dead we will face an issue which is Passenger won't wait till this transaction ends it will kill it and roll back the transaction so the logic in unsubscribe method won't be done which can cause unwanted behaviors in future especially if it's related to information must be committed in the database to use it in future.
What is the expected behavior?
We expect Passenger to wait until this transaction finishes, not to roll it back if it exceeds 1 sec.
What is the actual behavior?
Passenger rollback any transaction in unsubscribe when the last session dies when this transaction exceeds 1 sec.
How can we reproduce it? Please try to provide a sample application (or Virtual Machine) demonstrating the issue. Otherwise, if we can't reproduce it, we might have to ask you a number of followup questions or run certain commands to try and figure out the problem.
Be as detailed as possible in your descriptions, include any logs and stack traces (don't just cut/paste the error, provide some logging before that too).
(if you are requesting a feature instead of reporting an issue, describe here what you have in mind and how it would help you)
Your answer: I used a chatting app to test that
Question 2: Passenger version and integration mode: Your answer: open source 5.3.2 /nginx
Question 3: OS or Linux distro, platform (including version): Your answer: Ubuntu 20.04.3 LTS, x86-64
Question 4: Passenger installation method: Your answer: RubyGems + Gemfile
Question 5: Your app's programming language (including any version managers) and framework (including versions): Your answer: Ruby 2.7.0, Rails 5.2.5
Question 6: Are you using a PaaS and/or containerization? If so which one? Your answer: No
Question 7: Anything else about your setup that we should know?
Your answer: Logs