Files
mattermost/server/platform/services
Alejandro García MontoroandMattermost Build 9230eb6f6a MM-69725: Propagate context through Extractor.Extract using new mattermost/pdf fork (#37579)
* Propagate context through Extractor.Extract

Adds ctx context.Context to the Extractor interface and all
implementations so callers can cancel in-flight extractions.

pdfExtractor passes the context down to GetPlainText(ctx), which
checks ctx.Done() at each page boundary. When extractWithTimeout
fires (deadline exceeded or parent cancel), it cancels the derived
context via defer cancel(), and the PDF goroutine stops at the next
page rather than running to completion, eliminating the heap
growth that caused OOM on complex documents.

For non-context-aware extractors (docconv, plain, archive) the
context is accepted but not yet acted on; they continue to run
to completion on a detached goroutine after the timeout, as before.

The call site in channels/app/file.go passes rctx.Context() so
request cancellation (e.g. HTTP disconnect) also propagates.

* Use new mattermost/pdf fork

* Update notice reflecting the new fork

* Fail archiveExtractor.Extract early on ctx errors

* Bump mattermost/pdf to cd8a834041c4

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-07-28 17:29:36 +02:00
..
2025-06-10 15:04:57 -03:00