Skip to content

Large TIFF input can generate "Cumulated memory allocation" errors, unlimited flag is ignored #4446

Closed

Description

@Pb0001818

** (process:47088): WARNING **: 10:54:13.498: tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiffload: no property named `tiffSubifd'
Error handling file chunk: tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)
tiff2vips: Cumulated memory allocation of 11580342 + 22930420 bytes is beyond the 20971520 cumulated byte limit defined in open options
tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 34464756 bytes each)

Activity

  1. lovell commented on Aug 28, 2025

    @lovell
    Owner

    Hi, did you see the unlimited constructor option?

    sharp(input, { unlimited: true })...

    https://sharp.pixelplumbing.com/api-constructor/

    If you still require help, please provide a sample image that allows someone else to reproduce.

  2. Pb0001818 commented on Aug 29, 2025

    @Pb0001818
    Author

    Hi, thanks for your reply.

    I’m already using the constructor options:

    const originalImage = sharp(combinedFilePath, {
    limitInputPixels: false,
    failOnError: false,
    unlimited: true
    })

    However, I’m still getting the same error when processing some very large files (some are several GBs in size).

    Could you please confirm if limitInputPixels: false completely disables the pixel limit, or if there’s still an upper bound internally? And is there a recommended way to process extremely large images with sharp, or should I consider tiling/streaming them instead?

    Thanks for your help!

  3. lovell commented on Aug 29, 2025

    @lovell
    Owner

    I’m still getting the same error when processing some very large files (some are several GBs in size).

    If you still require help, please provide a sample image that allows someone else to reproduce.

  4. Pb0001818 commented on Aug 29, 2025

    @Pb0001818
    Author

    (https://www.transfernow.net/dl/20250829p4gKJqQy/RzkYXRXC) here is file and please tell if is there possible to get layer info from tiff file...?

  5. Torchu commented on Aug 29, 2025

    @Torchu

    I'm getting the same error.

    Error converting image: tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
    tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
    tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
    tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
    tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
    tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
    tiff2vips: Cumulated memory allocation of 11562892 + 9984432 bytes is beyond the 20971520 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for TIFFReadDirEntryArray (1 elements of 21518768 bytes each)
        at webpImageConverter (file:///var/task/index.js:80:13)
        at async handler (file:///var/task/index.js:53:32)
    

    I'm calling Sharp like this:

    return await Sharp(fileStream, {
          unlimited: true
        })
          .toFormat('webp')
          .toBuffer();

    EDIT: My file is 38.2 MB

  6. Pb0001818 commented on Aug 29, 2025

    @Pb0001818
    Author

    As a test, I downgraded to [[email protected]]
    , and it works fine there. So it seems this problem only occurs in newer versions.

    Could you confirm if there’s been a change to how limitInputPixels: false is handled in recent releases, or if there’s another recommended way to process extremely large images?

    Thanks again!

  7. Torchu commented on Aug 29, 2025

    @Torchu

    As a test, I downgraded to [[email protected]] , and it works fine there. So it seems this problem only occurs in newer versions.

    Could you confirm if there’s been a change to how limitInputPixels: false is handled in recent releases, or if there’s another recommended way to process extremely large images?

    Thanks again!

    Thanks!! Downgrading the version solved my issue as well. I'm only using the unlimited option, so I guess there's an issue with that option at least in 0.34.3

  8. lovell commented on Aug 29, 2025

    @lovell
    Owner

    This is likely to relate to the upstream problem being discussed at libvips/libvips#4649

  9. changed the title [-]Cumulated memory allocation[/-] [+]Large TIFF input can generate "Cumulated memory allocation" errors, unlimited flag is ignored[/+] on Aug 29, 2025
  10. added this to the v0.34.4 milestone on Sep 12, 2025
  11. lovell commented on Sep 15, 2025

    @lovell
    Owner

    A release candidate is now available with the fix if you're able to test:

    npm install [email protected]
    
  12. Pb0001818 commented on Sep 16, 2025

    @Pb0001818
    Author

    npm install [email protected]

    tested showing some warnings but its working fine for me thank you

    ** (process:19692): WARNING **: 10:19:53.961: tiff2vips: Cumulated memory allocation of 51854204 + 51808152 bytes is beyond the 52428800 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for custom tag binary object (51808152 elements of 1 bytes each)
    tiff2vips: Cumulated memory allocation of 51854204 + 51808152 bytes is beyond the 52428800 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for custom tag binary object (51808152 elements of 1 bytes each)
    tiffload: no property named `tiffSubifd'

    ** (process:19692): WARNING **: 10:19:55.180: tiffload_buffer: no property named `tiffSubifd'

    ** (process:19692): WARNING **: 10:19:55.412: tiff2vips: Cumulated memory allocation of 51854204 + 51808152 bytes is beyond the 52428800 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for custom tag binary object (51808152 elements of 1 bytes each)
    tiff2vips: Cumulated memory allocation of 51854204 + 51808152 bytes is beyond the 52428800 cumulated byte limit defined in open options
    tiff2vips: Failed to allocate memory for custom tag binary object (51808152 elements of 1 bytes each)
    tiffload: no property named `tiffSubifd'

  13. lovell commented on Sep 16, 2025

    @lovell
    Owner

    tiffload: no property named `tiffSubifd'

    Thanks for reporting this, it looks like there was a regression in 0.34.3, which I've fixed via commit 35d3f56

  14. lovell commented on Sep 17, 2025

    @lovell
    Owner

    v0.34.4 now available.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions