Skip to content

LZ4 and lazy decompression fixes - #277

Merged
embray merged 5 commits into
asdf-format:mainfrom
embray:issue-274
Oct 14, 2026
Merged

embray merged 5 commits into
asdf-format:mainfrom
embray:issue-274

Conversation

@embray

@embray embray commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Description

Resolves #276 and will resolve #274 when done.

AI Disclosure

No AI used.

@embray embray added the bug Something isn't working label Oct 13, 2026
- Subsequent calls to ``asdf_ndarray_read_tile_2d`` on the same array
  accidentally reused the raw, compressed data pointer, rather than
  reusing an existing decompressed data pointer.

- Bug causing early exit from a the lazy decompression handle_pagefault
  loop, if the pagefault occurred past the first page of a multi-page
  ``decomp.chunk_size``.  This was missed in prior testing partly due
  to asdf-format#276 which obscuring possible issues with lazy decompression, and
  partly due to poor test coverage of different ``decomp.chunk_size``
  settings.

Better documented the lazy decompression/UFFD code since I had started
to forget how some of it works myself.

asdf-formatgh-274
This is explained more in the code, but the basic idea is that if
multiple threads are reading simultaneously from a lazy-decompressed
memory range, it could result in multiple attempts to decompress the
same chunk of compressed data, which resulted in an ioctl error causing
the fault handler thread to exit (thus causing any further page faults
to *not* be handled and block and/or segfault the application.
macOS apparently doesn't have the pthread_barrier API, a problem I also
ran into on libasdf-gwcs but forgot about.

Also go ahead and commit some TRACE log messages used while debugging
this.  Since they are TRACE level they won't add any sig overhead by
default.
@embray
embray marked this pull request as ready for review October 14, 2026 15:23
@embray
embray merged commit 4e596f8 into asdf-format:main Oct 14, 2026
12 checks passed
@embray
embray deleted the issue-274 branch October 14, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decompression does not default to lazy mode where supported SIGSEGV on tile read into LZ4-compressed arrays

1 participant