Skip to content

INTERNAL: Close the lanes, finishing the job each runs - #24

Merged
namsic merged 1 commit into
developfrom
lane-shutdown
Nov 13, 2026
Merged

namsic merged 1 commit into
developfrom
lane-shutdown

Conversation

@ing-eoking

@ing-eoking ing-eoking commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

🔗 Related Issue

⌨️ What I did

lane들을 닫는 pool::shutdown()을 추가합니다.

동작

shutdown()
  모든 lane: closed = true 설정 → Op::Shutdown 전송
lane (run 루프)
  다음 task를 꺼낼 때 closed면 → 루프 종료
    실행 중이던 job: 끝까지 실행
    큐에 남은 job: 실행하지 않고 drop
                   → IoWait drop으로 연결을 깨움 → SERVER_ERROR internal
  쉬던 lane: recv에서 Op::Shutdown을 받고 깨어나 같은 검사로 종료
이후 submit: 채널이 닫혀 send 실패 → false

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ing-eoking
ing-eoking force-pushed the lane-shutdown branch 2 times, most recently from e711a97 to 51dbe49 Compare November 5, 2026 09:09
@ing-eoking
ing-eoking force-pushed the lane-ops branch 2 times, most recently from 72aa82f to df59c56 Compare November 6, 2026 00:05
@ing-eoking
ing-eoking marked this pull request as draft November 6, 2026 03:15
@ing-eoking
ing-eoking force-pushed the lane-shutdown branch 2 times, most recently from dba1e98 to d37773c Compare November 6, 2026 07:58
@ing-eoking
ing-eoking force-pushed the lane-ops branch 2 times, most recently from 1d0afc9 to bf83e9a Compare November 6, 2026 08:35

@zhy2on zhy2on left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit는 참고용으로 남겼습니다. 수정하지 않으셔도 될 것 같습니다.

Comment thread src/aio/ops.rs
.then_some(Cow::Borrowed(&b"DROPPED\r\n"[..]))
.ok_or(Error::NotFound),
// A lane ends on it before it runs.
Op::Shutdown => Err(Error::Internal),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Shutdown이 Op에 들어가면서, 실제로는 쓰이지 않는 ops::run의 Shutdown 처리와 lane()의 Option이 생긴 것 같습니다.
아래처럼 Shutdown을 따로 두면 이 코드는 필요 없어질 것 같습니다.

enum Msg {
    Task(Task),
    Shutdown,
}

다만 Task를 한 번 더 감싸야 해서 오히려 복잡해질 수도 있을 것 같습니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아마 추후 리팩토링에서 Op라는 이름 대신에 Job 같은 이름으로 변경할 것 같습니다.
참고해주시면 좋을 것 같습니다.

Comment thread src/aio/pool.rs
Comment on lines +100 to +108
/// Has each lane end once the job it runs is done; the queued ones drop unrun, waking their
/// connections to an internal error. Does not wait for the lanes to end.
#[expect(dead_code, reason = "nothing closes the lanes yet")]
pub fn shutdown() {
// SAFETY: a non-null `POOL` is a leaked array, never freed.
if let Some(lanes) = unsafe { POOL.load(Ordering::Acquire).as_ref() } {
lanes.iter().for_each(close);
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abort는 클라이언트 연결이 종료될 때 불리는 콜백이라 lane을 닫으면 안 된다고 하는데, 아닌가요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abort는 클라이언트 연결이 종료될 때 불리는 콜백이라 lane을 닫으면 안 된다고 하는데, 아닌가요?

PR 코멘트를 수정을 안 해놓았습니다.

abort는 클라이언트 연결이 종료될 때 불리는 게 맞으며, 현재는 abort에서 레인을 종료하는 로직은 이미 없는 상태입니다.

Comment thread src/aio/ops.rs
Comment on lines +43 to +44
// A lane ends on it before it runs.
Op::Shutdown => Err(Error::Internal),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 실제로는 도달 불가 분기인 듯 합니다.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아마 이 부분은 나중에 로그만 남기는 걸로 변경할 것 같습니다.

  Op::Search => ...
  Op::Replace => ...
  ...
  _ => warn("Arcus Vector: An unexpected task was received.")

@namsic namsic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이후 구현에 의존하거나 리팩토링에서 다시 변경될 코드라서, PR 하나하나 확인할 필요가 크지 않아 보여 approve 합니다. 마지막에 다시 확인하는 것으로 하겠습니다.

@ing-eoking
ing-eoking changed the base branch from lane-ops to develop November 13, 2026 07:13
@ing-eoking
ing-eoking marked this pull request as ready for review November 13, 2026 07:13
@namsic
namsic merged commit 072a5ed into develop Nov 13, 2026
2 checks passed
@namsic
namsic deleted the lane-shutdown branch November 13, 2026 07:19

This branch was successfully deployed

1 active deployment
ee — 072a5edc Deployed Nov 13, 2026 by ing-eoking via Build arcus-memcached #90
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants