HermitCrab analysis can spin on simultaneous rewrites with incompatible environments

Đang mở
#623 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@johnml1135 đang làm issue này rồi.

Từ ngày 9/11/2026.

  • #624 của @johnml1135 — đang mở

Đá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
58/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

Start with AnalysisRewriteRule.cs around the SelfOpaquing selection and reapplication loop, then inspect SimultaneousPhonologicalPatternRule.cs and its no-match behavior. Add regression cases for the three reduced shapes in the issue and check that reapplication stops when a simultaneous rule makes no change. The issue does not identify test file paths, so locate the existing analysis rewrite tests before adding cases; verify the cases terminate and produce the expected parses.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

HermitCrab’s C# analysis parser can hang indefinitely in a simultaneous rewrite when a replacement segment conflicts with an environment segment, consuming one CPU core; the pinned hc.dll reproduced all three reported shapes.

  • Minimal segment case: one-feature t → d / _ a, underlying ta, parse da.
  • Alpha-input case: input [nasal:+, α(place)], output m, environment _ p with p nasal−; parse prefixed mp.
  • Underlying realization case: one rule ʔ → - / _ V[+vocalic], underlying ʔa, parse -a.
  • Suspected source: AnalysisRewriteRule.Apply selects an unbounded SelfOpaquing loop when RHS and environment feature structures are incompatible; SimultaneousPhonologicalPatternRule.Apply returns a word even when it finds no matches.
  • Not known: whether synthesis has the same reapplication behavior.

Next: add regression cases for these reduced shapes and make self-opaquing reapplication stop when the simultaneous rule makes no change.

Reproduction and evidence

Replayed with the Release HermitCrab CLI from Machine commit 4d9b454d42a0da35e058641a65596339a79d115b using dotnet hc.dll -i <grammar.xml> -s <script>. The three original inputs each timed out at 45 seconds; all reduced shapes timed out at 10 seconds. Each timeout used a captured process PID and direct SIGTERM. Reduced runs sampled 107–112% CPU on one process. Compatible-output, no-environment, and feature-removal controls completed promptly.

At the pin, AnalysisRewriteRule.cs:47-69 selects SelfOpaquing after the RHS/environment FeatureStruct.IsUnifiable check fails; :166-173 has no progress or termination guard. SimultaneousPhonologicalPatternRule.cs:22-35 always returns the input word, including when Matcher.AllMatches produces no applicable match. The reduced alpha-input case also hangs after α is removed while retaining the feature-bearing input class, and the glottal case hangs with a single rule, so neither α nor the original rule chain is necessary to the loop.

The pin-matched driver was absent from the exact-pin worktree, so the Tool Release project was built from an exact-pin source archive (SHA-256 of resulting hc.dll: 9cd575be98ddb4e9e32e63114ee699c94d7a395af2074ad15f1557a272404964). The related loop files are unchanged in locally fetched Machine origin/master 9f284a3cc4d5e2c5896f885ba1103fb30594b1e8.

Found while comparing HC-Rust (PanGloss) with pinned hc.dll; PanGloss answers all three in about 1 ms.

Ngôn ngữ chính
C#
Star
29
Fork
16
Merge trung bình
5 ngày 11 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của sillsdev/machine

Tất cả issue của sillsdev/machine

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.