Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with 2 different versions of sharp running on Alpine Linux inside home-assistant inside a proxmox VM #2595

Closed
danielo515 opened this issue Feb 25, 2021 · 7 comments
Labels

Comments

@danielo515
Copy link

danielo515 commented Feb 25, 2021

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

[email protected] /config/node-red
├─┬ [email protected]
│ └── [email protected]
└── [email protected]

Seems that I do not (latest is 0.27.2) and I in fact have two sharp versions.

What are the steps to reproduce?
Just loading a image from any of my security cameras triggers a core dump

In my case all I have to do is to load the attached image and try any operation on it: draw on it, resize or save to a different location. Everything triggers a crash + memory dump

What is the expected behaviour?

To not crash and perform the operations on the image

Are you able to provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem?
I'll try to do it later today

Are you able to provide a sample image that helps explain the problem?
Yes, find it attached

raw_body

What is the output of running npx envinfo --binaries --system?
npx: installed 1 in 4.142s

System:
OS: Linux 5.4 Alpine Linux
CPU: (2) x64 Common KVM processor
Memory: 105.91 MB / 3.74 GB
Container: Yes
Shell: 1.32.1 - /bin/ash
Binaries:
Node: 14.15.5 - /usr/bin/node
npm: 6.14.11 - /usr/bin/npm

But I can provide details about the environment. The code runs inside a docker container that runs inside home-assistant that runs inside a proxmox VM.

@lovell
Copy link
Owner

lovell commented Feb 25, 2021

What is the output of running npx envinfo --binaries --system?

I'll try to do add it later (don't have access RN to the device)
The code runs inside a docker container that runs inside home-assistant that runs inside a proxmox VM.

The output of this command run inside the container will help.

Please ensure installation was for the relevant platform - see https://sharp.pixelplumbing.com/install#common-problems

@lovell lovell added question and removed triage labels Feb 25, 2021
@lovell
Copy link
Owner

lovell commented Mar 23, 2021

@danielo515 Were you able to make any progress with this?

@danielo515
Copy link
Author

@danielo515 Were you able to make any progress with this?

Sorry I forgot about this (I have been away from my homelab for a while anyway). I just updated the issue with the NPX env info

@lovell
Copy link
Owner

lovell commented Mar 24, 2021

Thanks for the update, I spotted you posted at iceglow/node-red-contrib-deepstack#3 too.

Prebuilt binaries are provided for musl-based Linux on x64, but it's possible two different versions of these are causing a conflict. Please can you upgrade/downgrade the versions of sharp so they match.

The next release of sharp, v0.28.0, will provide statically-linked binaries that should remove almost all possibility of this class of problem from occurring. Please subscribe to #2604 for updates.

@lovell lovell changed the title Trying any operation on this image triggers a core dump Crash with 2 different versions of sharp running on Alpine Linux inside home-assistant inside a proxmox VM Mar 24, 2021
@danielo515
Copy link
Author

I am not sure that the conflicting version is library's fault. I installed it manually to test the problem with my own code but on the same environment. Do you think that removing it will fix the problem? I will try and comment again.

@danielo515
Copy link
Author

I just uninstalled the version I installed, tried the same example and the same occurs:

image

The code of the outline function is here:

https:/iceglow/node-red-contrib-deepstack/blob/7ac06c33bb726727323fbd1a8957aa6651e39551/image-manipulation.js

const outline = function(buffer, outlines, outlineColor) {
        return sharp(buffer).metadata().then(meta => {
            let svgOverlay = '';

            outlines.forEach(o => {
                svgOverlay += '<rect x="' + o.x + '" y="' + o.y + '" width="' + o.width + '" height="' + o.height + '" ' +
                    'style="fill:none;stroke:' + outlineColor + ';stroke-width:3;" />';
            });
            return '<svg width="' + meta.width + '" height="' + meta.height + '">' + svgOverlay + '</svg>';
        }).then(overlay => {
            return sharp(buffer).composite([{
                input: Buffer.from(overlay),
                blend: 'over'
            }]).toBuffer();
        });
    }

@danielo515
Copy link
Author

I can confirm that upgrading sharp to the latest version (0.28) inside the library this problem dissapears, so now it is the task of the extension to update to latest sharp.

Thank you very much for your help on this.

iceglow added a commit to iceglow/node-red-contrib-deepstack that referenced this issue Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants