Skip to content

[BUG] File handler being closed by UserDefinedFunction #242

Description

@marmoure

If we pass a file handler to a UserdefinedFunction the file handler will be closed once the call is done, even though it still needed for the rest of the code.

how to reproduce

  1. Create a test file echo "hello" > /tmp/file
  2. Run this script
xquery version "3.1";
declare namespace file = "http://exist-db.org/xquery/file";
declare function local:noop($b) { 1 };

let $b := file:read-binary("/tmp/file")

let $tmp := local:noop($b)

(: no longer accessible:)
return string($b)

results

We get Underlying channel has been closed

expected

We should get the string value of the file.

This issue is similar to eXist-db/exist#6725 but we are sure it's not coming from the same origin.

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