Skip to content

c_import cost is (macros + pointer uses) x header: bzip2 and libcurl time out on the Windows release legs #1203

Closed

Description

@ehartford

Release validation runs 35388740596 and 35420376179: on windows-x86_64 and windows-aarch64, with run in the bzip2 and libcurl UAT projects exits 124 at ~185 s.

Evidence: the package-failures-windows-x86_64 artifact has three minidumps per hung with.exe, 16 s apart. Opened in lldb on macOS with the DWARF in with.exe, the main thread is either waiting while libclang's parse thread runs, or inside process_c_import_with_defines -> ci_collect_missing_pointer_opaques -> ci_type_decl_name_exists, ci_prepopulate_names, ci_translate_var. Not a hang: c_import is slow, everywhere.

Local repro (macOS), N typedef'd structs + functions + non-literal macros: with check takes 8 / 29 / 120 s for N = 1000 / 2000 / 4000. sample puts 70% in with_cimport_parse_macro_probe -> clang_parseTranslationUnit: ci_try_translate_object_macro_probe parses the WHOLE header once per object macro that is not a plain literal (non-system headers only, i.e. exactly the package headers). On Windows each of those parses re-reads windows.h. After that: ci_type_decl_name_exists / ci_record_definition_exists / ci_prepopulate_names, a scan of every declaration per query.

Fix on the campaign branch (PR #1191): one probe parse per import with per-line error attribution; a declaration-name index per session. Same sizes now 7 / 8 / 16 s; translated text byte-identical for curl, sqlite3, gl3, zlib, bzlib, stdio. test/behavior/behav_c_import_scales_linearly.w holds the ratio.

Still visible in the profile afterwards, not addressed here: rt_payload_start_is_owned is the top frame of what remains (string ownership lookups in the runtime).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions