Long RPCs ignore cancellation mid-operation; a done context only withholds the answer
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Start with the existing context checks in internal/frontend/grpc/runs.go and the handler locations listed in the issue, then trace the long parse, convert, query, render, and document operations. Add bounded cancellation checks through those paths and update the contract comment in client/opensysml/inprocess.go. Add deterministic counting-context tests for mid-loop cancellation and deadlines; done means each listed RPC returns the context status promptly and concurrent calls remain unaffected.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Disclaimer, this issue was detected and written by an AI
Summary
Most engine calls honour a context: RunRuns, RunSweep, CheckBehavior,
CompareResults, Explore*, ImportData and SelfCheck notice ctx.Err() and
stop (or return it). The long parse/convert/query/render paths do not.
client/opensysml/inprocess.go:258 states the current contract:
The engine runs a call to completion; a done context withholds whatever it
produced, answer or error, as the wire does.
So a caller deadline returns DEADLINE_EXCEEDED while the engine keeps parsing,
converting or querying. On a memory-constrained host a handful of timed-out
requests stack full CPU and memory cost: the timeouts make the overload worse,
not better.
Where the checks already are
internal/frontend/grpc/runs.go:173,261(RunRuns)internal/frontend/grpc/sweep.go:143(RunSweep)internal/frontend/grpc/check.go:186(CheckBehavior)internal/frontend/grpc/compare.go:196(CompareResults)internal/frontend/grpc/explore.go:45(Explore*)internal/frontend/grpc/importdata.go:49(ImportData)internal/frontend/grpc/selfcheck.go:56(SelfCheck)
These return ctx.Err(); connect maps context.Canceled/DeadlineExceeded, and
the in-process answer maps them through contextStatus (inprocess.go:271).
Where they are missing (the work)
Add the same pattern — check at phase boundaries and every N elements/documents,
then return ctx.Err() — to:
| RPC | File | Where to check |
|---|---|---|
ParseFile |
internal/frontend/grpc/service.go:824 |
before/after the parse |
ParseSources |
service.go:857 |
per document in the set, and between analysis and the response build |
Convert |
export.go:28 |
before preparation, between export.PrepareModel, toGraph, graph build and serialization; per document in convertModelOfDocuments (export.go:564) |
Migrate |
export.go:189 |
per migrated document/phase |
Query |
query.go:99 |
in candidates/collect and when building rows, every ~1024 elements |
RenderView |
render_view.go |
before and after the render |
RenderDocument |
documents.go (render path) |
before and after the render |
ExportGraphs |
export_graphs.go |
before and after the export |
RunDocumentQuery |
docquery.go |
per row |
InstancePaths |
instancepaths.go |
per node during the walk |
ElementProperties |
element_properties.go |
per document/element |
Instantiate |
objects.go |
per behavior/object |
Notes:
- Check cheaply:
if err := ctx.Err(); err != nil { return nil, err }at the top
of each document/row and every few hundred elements; do not callctx.Err()
per property. - Return the context error unchanged, so the wire code is
CANCELLED/
DEADLINE_EXCEEDEDon both transports. Do not turn it into anINVALID_ARGUMENT
or a 200 witherror. - After this, update the
inprocess.go:258comment: the engine checks the
context where the work is long, and a done context returns the status. ParseSourcesis the biggest win in-process: a 572 KB/13-document project
takes ~2 s cold, and an abandoned tree read or export currently keeps it
running.
Tests
Service tests (internal/frontend/grpc), calling the handlers directly like
affected_test.go does:
- A counting context that answers nil for N
Err()calls and
context.Canceledafterwards.ParseSourcesandConvertover a large model
returnCodeCanceled(not a result), and return before the uncancelled call
would have finished. Pin the exact behaviour: with N below the first check the
call is untouched; with N inside the document loop it stops after the current
document. - The same for
Queryover a large scope. context.DeadlineExceededyieldsCodeDeadlineExceeded, notCodeCanceled.- A concurrent call on another model still completes (no shared cancellation).
- An in-process client test (
client/opensysml) drivesParseDocumentswith the
counting context and assertsStatusError{Code: CodeCanceled}and that the
partial model is not returned.
Avoid wall-clock-only tests: under a loaded 4-core box a 2 s parse is not a stable
oracle. The counting context makes the stop point deterministic.
Acceptance
- Every long RPC above stops within a bounded number of elements/documents of
a cancellation and returnsCANCELLED/DEADLINE_EXCEEDED. - A pre-cancelled request still returns immediately (unchanged).
- Concurrent calls are unaffected.
- The
answercomment and any docs that say "runs to completion" are updated. - Tests cover both cancellation and deadline, at a mid-loop check point.
- Ngôn ngữ chính
- Go
- Star
- 59
- Fork
- 20
- Merge trung bình
- 10 giờ 23 phút
- Pull request đã merge (30 ngày)
- 897
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Open-MBEE/OpenSysML
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
A model's parse is still paid cold in every process; the library record cache does not cover itĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Open-MBEE/OpenSysML
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
AvengeMedia/DankMaterialShell#4301 · 1 bình luận ·
-
priority: p2 type: bug type: docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
googleapis/google-cloud-swift#1641 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
krakenhavoc/cmd_and_ctrl#5853 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
flaky test: TestTRTAsyncPrefillFailures/transport reads the token load before prefillDone has released itCó thể đã có người làm @Jackmeson1 đã nhận hôm nay. Đang mởarea/cicd area/gateway kind/misc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
vllm-project/aibrix#3488 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày