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

[BUG] Property resolution leads to SEGV when POM has no own props #390

Closed
1 task done
ascheman opened this issue Oct 31, 2023 · 5 comments · Fixed by #425
Closed
1 task done

[BUG] Property resolution leads to SEGV when POM has no own props #390

ascheman opened this issue Oct 31, 2023 · 5 comments · Fixed by #425
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@ascheman
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Konveyor version

How can I get it? I am using Analyzer-LSP directly!

Priority

Blocker

Current Behavior

When analysing a Java POM with a dependency as a property, analyzer tries to resolve the property in the same POM. If the POM contains no properties at all, this leads to a segmentation violation (in line 141 of provider/internal/java/dependeny.go):

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5b3ddc]

Expected Behavior

Try to resolve property via parent POM (hierarchy) or leave unresolved otherwise (which is the default, if the property cannot be found in an existing POM property list).

How Reproducible

Always (Default)

Steps To Reproduce

Prepare a project with POM like this.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>some-project</groupId>
    <artifactId>some-artifact</artifactId>
    <version>does-not-matter</version>
    
    <dependencies>
        <dependency>
            <groupId>some-dep-group</groupId>
            <artifactId>some-dep-artifact</artifactId>
            <version>${cannot-be-resolved}</version>
        </dependency>
    </dependencies>
</project>

And analyze it.

Environment

Have to provide a minimal example ...

Anything else?

No response

@ascheman ascheman added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 31, 2023
@jmle
Copy link
Contributor

jmle commented Oct 31, 2023

@ascheman thank you for filling this bug! Do you want to give it a shot and fix it? Otherwise I'll pick it up.

@ascheman
Copy link
Contributor Author

Thanks for picking this up, @jmle - I have a workaround in progress (at least to avoid the SEGV) and can contribute it soon.

In general I would be happy to provide a test case to avoid regressions for this in the future, and of course a full solution. But I need some more time to set this up. Therefore I would appreciate some help.

@jmle
Copy link
Contributor

jmle commented Oct 31, 2023

Cool @ascheman, feel free to ask any questions in the #konveyor-dev slack channel

@ascheman
Copy link
Contributor Author

Would be happy to proceed there: https://kubernetes.slack.com/archives/C04QZJFQ0UA/p1698750038252959

@github-project-automation github-project-automation bot moved this to 🆕 New in Planning Oct 31, 2023
@pranavgaikwad pranavgaikwad removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Oct 31, 2023
@pranavgaikwad pranavgaikwad moved this from 🆕 New to 🔖 Ready in Planning Oct 31, 2023
@jmle jmle assigned jmle and ascheman and unassigned jmle Oct 31, 2023
ascheman added a commit to ascheman/analyzer-lsp that referenced this issue Oct 31, 2023
CAUTION: The property search should be extended to the parent
POM (hierarchy).
ascheman added a commit to ascheman/analyzer-lsp that referenced this issue Nov 1, 2023
CAUTION: The property search should be extended to the parent
POM (hierarchy).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 9, 2023
CAUTION: The property search should be extended to the parent
POM (hierarchy).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 10, 2023
CAUTION: The property search should be extended to the parent
POM (hierarchy).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 10, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
@ascheman
Copy link
Contributor Author

It is hard to reproduce this error now - it only occurs during fallback resolution of POM dependencies which is no longer the case when mvn dependency:tree works as expected (cf. #393). I was trying to provide an integration test by making the examples/java project a Multi-Module project with a submodule without properties. However, the respective code is not used during a dependency analysis any longer.

Will try to provide a unit test for this.

ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 13, 2023
…eyor#420).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 15, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 15, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
pranavgaikwad pushed a commit that referenced this issue Nov 15, 2023
Fixes #390 
CAUTION: 
* This change only provides a workaround to avoid the SEGV of #390
* It does not find the property contents, the property search should be
extended to the parent POM (hierarchy).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
@github-project-automation github-project-automation bot moved this from 🔖 Ready to ✅ Done in Planning Nov 15, 2023
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 17, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 17, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 17, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 17, 2023
…eyor#420).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 17, 2023
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 17, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
…eyor#420).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
…eyor#420).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
…eyor#420).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
…eyor#420).

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
ascheman added a commit to qaware/analyzer-lsp that referenced this issue Nov 20, 2023
Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
jmle pushed a commit that referenced this issue Nov 21, 2023
Adding test cases for #390.

The Java example was refactored to make it run (i.e., `mvn compile` at
least), and extended by a submodule.
The submodule contains a property based dependency version which cannot
be immediately resolved, as there is no `properties` definition in the
submodule itself.

The hotfix provided by #425 prevents the binary from failing. 
Nevertheless, the version property should be resolved from the parent
pom which is not yet addressed.

As the bug report only was about the SEGV caused by the problem, #390
may be closed anyway.

---------

Signed-off-by: Gerd Aschemann <gerd@aschemann.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants