Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shutdown doesn't complete #295

Closed
Gibheer opened this issue Mar 17, 2020 · 2 comments
Closed

shutdown doesn't complete #295

Gibheer opened this issue Mar 17, 2020 · 2 comments
Assignees
Labels
bug Something is not working.

Comments

@Gibheer
Copy link
Contributor

Gibheer commented Mar 17, 2020

Describe the bug

When stopping serving kratos it doesn't shutdown completely and just hangs around. I have to kill -9 the process to make it stop.

Reproducing the bug

Steps to reproduce the behavior:

  1. Run ./kratos serve --config kratos.yaml with minimal settings
  2. Press ctrl+c to stop the daemon

Server logs

./kratos serve --config kratos.yaml
INFO[0002] Config file loaded successfully.              path=kratos.yaml
INFO[0002] Software quality assurance features are enabled. Learn more at: https://www.ory.sh/docs/ecosystem/sqa 
INFO[0002] Starting the admin httpd on: 0.0.0.0:4434    
INFO[0002] Starting the public httpd on: 0.0.0.0:4433   
^CINFO[0009] Public httpd was shutdown gracefully         
INFO[0009] Admin httpd was shutdown gracefully          
^C^C^C

Server configuration

---
dsn: "postgres://kratos:@pg1.example.org/iam?sslmode=disable"

hashers:
  argon2:
    memory: 1048576
    iterations: 2
    parallelism: 4
    salt_length: 16
    key_length: 32

courier:
  smtp:
    connection_uri: smtps://localhost/
    from_address: iam@example.org

identity:
  traits:
    default_schema_url: http://gibheer.zero-knowledge.org/default_identity.json

selfservice:
  logout:
    redirect_to: https://example.org

urls:
  profile_ui: https://iam.example.org
  mfa_ui: https://iam.example.org/mfa
  login_ui: https://iam.example.org/login
  registration_ui: https://iam.example.org/register
  error_ui: https://iam.example.org/failed
  verify_ui: https://iam.example.org/verify
  default_return_to: https://example.org
  self:
    public: "http://0.0.0.0:8080"
    admin: "http://0.0.0.0:9292"

Expected behavior

I should be able to stop the daemon either with ctrl-c or using a normal kill.

Environment

  • Version: master, 537d496
  • Environment: FreeBSD 12.1-RELEASE-p2, Go 1.14
@aeneasr
Copy link
Member

aeneasr commented Mar 17, 2020

Thank you, tracked

@aeneasr aeneasr added the bug Something is not working. label Mar 17, 2020
@aeneasr aeneasr added this to the v0.1.2-alpha.1 milestone Mar 17, 2020
@aeneasr aeneasr self-assigned this Mar 17, 2020
@Gibheer
Copy link
Contributor Author

Gibheer commented Mar 17, 2020

From some testing I have figured out that the context given to courier.Work doesn't work, because it is a simple Background worker, which is never canceled.

From what I can tell, the background context would need to be extended with WithCancel and extended with a signal handler.
The other way would be to adopt the graceful package.

I will see if I can adapt the code for the latter option, maybe I can get it working.

aeneasr pushed a commit that referenced this issue Apr 7, 2020
Courier would not stop with the provided Background handler.
This changes the methods of Courier so that the graceful package can be
used in the same way as the http endpoints can be used.

Closes #295
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

2 participants