Investigate not writing a machine to DB until registered #130

Closed
opened 2025-12-29 01:23:39 +01:00 by adam · 3 comments
Owner

Originally created by @kradalby on GitHub (Feb 20, 2022).

Currently a Machine object is created in the database immediately when the registration process starts, and not always clean up.

This seem to be to hold temporary data between requests during the registration process.

This often leads to half-finished machine objects being left around in the database, this specially happens when registering Windows clients for some reason.

This ticket is to track an effort to not save the machine object to the database until it is actually registered, as there is no real point to have it in there. Any in-flight registration should be able to live in memory until complete.

Originally created by @kradalby on GitHub (Feb 20, 2022). Currently a Machine object is created in the database immediately when the registration process starts, and not always clean up. This seem to be to hold temporary data between requests during the registration process. This often leads to half-finished machine objects being left around in the database, this specially happens when registering Windows clients for some reason. This ticket is to track an effort to not save the machine object to the database until it is actually registered, as there is no real point to have it in there. Any in-flight registration should be able to live in memory until complete.
adam added the enhancement label 2025-12-29 01:23:39 +01:00
adam closed this issue 2025-12-29 01:23:40 +01:00
Author
Owner

@restanrm commented on GitHub (Feb 22, 2022):

Could it be instead put in special table with expiration date and cleanup job ?

I'm thinking that in case of distributed deployment, in memory state will not work.

@restanrm commented on GitHub (Feb 22, 2022): Could it be instead put in special table with expiration date and cleanup job ? I'm thinking that in case of distributed deployment, in memory state will not work.
Author
Owner

@kradalby commented on GitHub (Feb 22, 2022):

That would be a possibility, I want it to have as little logic as possible, registration should not need to be inflight for long.

but I dont know what is a good approach, so needs some thought.

@kradalby commented on GitHub (Feb 22, 2022): That would be a possibility, I want it to have as little logic as possible, registration _should_ not need to be inflight for long. but I dont know what is a good approach, so needs some thought.
Author
Owner

@restanrm commented on GitHub (Feb 22, 2022):

An in-memory solution seems quite good. It still should be implemented with interfaces in mind to be replacable by a small implementation of an external service like Redis in my opinion

@restanrm commented on GitHub (Feb 22, 2022): An in-memory solution seems quite good. It still should be implemented with interfaces in mind to be replacable by a small implementation of an external service like Redis in my opinion
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#130