Skip to content

Segmentation Fault on .NET 5 build for standalone for ARM #41421

Closed

Description

@shadowfox87

Description

This bug is reproduceable on any version of .NET 5 after preview 6.

  1. Build a standalone executable for Linux ARM, and use the produce single file option
  2. It will give segmentation fault at the point on your code you instantiate a new TcpListener class. It works fine if you try on windows x64.

This is the line at where you will see it:

_listener = new TcpListener(address, port);

If you use the TRIM within the produce single file, it misses some assemblies that are used for webclient (given the same settings from before). This won't work even when trying on windows x64.

Configuration

  • Which version of .NET is the code running on?
    .NET 5 Preview 8 (can use any version after Preview 6)

  • What OS and version, and what distro if applicable?
    Archlinux latest version

  • What is the architecture (x64, x86, ARM, ARM64)?
    ARM

  • Do you know whether it is specific to that configuration?
    It won't work on ARM but works fine on Windows x64 (but will fail if TRIM is used)

Regression?

  • Did this work in a previous build or release of .NET Core, or from .NET Framework?
    Yes it worked on all versions before preview 7.

Activity

  1. added
    untriaged
    on Aug 26, 2020
  2. added
    linkable-framework
    on Aug 27, 2020
  3. joperezr commented on Aug 27, 2020

    @joperezr
    Member

    cc: @eerhardt this sounds like we are missing an annotation on System.Net.Sockets causing us to trim things that we shouldn't be trimming.

  4. joperezr commented on Aug 27, 2020

    @joperezr
    Member

    if it is indeed a missing annotation, then we probably will want to take this for 5.0

  5. karelz commented on Aug 27, 2020

    @karelz
    Member

    @joperezr is it something we (Networking team) should help with?

  6. joperezr commented on Aug 27, 2020

    @joperezr
    Member

    I don't think so, in dotnet 5 we formed a v-team that has been working on making sure our framework is linker-friendly so we've been adding annotations on the framework and I just want to make sure that this issue doesn't mean that we missed one. We can take a look.

  7. joperezr commented on Aug 27, 2020

    @joperezr
    Member

    @shadowfox87 are you able to get a dump of that so that we can check the managed callstack to see what is the problem here? I tried reproing this using the Preview 8 bits on a RaspberryPi but didn't have any luck. This is the code that I tried:

        class Program
        {
            static void Main(string[] args)
            {
                var listener = new TcpListener(IPAddress.Any, 8080);
                Console.WriteLine(listener.ToString());
            }
        }

    I published that for linux-arm and published it Trimmed and single file. I can validate that the linker is in fact running and trimming some assemblies. The result runs fine for me on my Raspberry Pi. Can you send more info regarding repro steps as well as a full code snippet of what you are doing to reproduce this issue?

  8. HKunogi commented on Aug 27, 2020

    @HKunogi

    unknown (1)
    unknown (2)
    unknown
    unknown (3)
    If unmark the Produce single file, it stops giving the issue and works fine.
    Also, if trim unused assemblies is marked, gives this issue:
    Untitled

  9. shadowfox87 commented on Aug 27, 2020

    @shadowfox87
    Author

    @joperezr I can confirm the answer above. If you need any further information, @HKunogi can answer.

  10. joperezr commented on Aug 27, 2020

    @joperezr
    Member

    Can you confirm which version of the SDK are you using? to figure this out try running dotnet --list-sdks and dotnet --version as it may be that what you are hitting is already addressed by an annotation that was added later.

  11. 22 remaining items

  12. deleted a comment from on Dec 7, 2020
  13. karelz commented on Feb 10, 2021

    @karelz
    Member

    @vitek-karas what would be next step here?
    Where should we route the issue?

  14. vitek-karas commented on Feb 10, 2021

    @vitek-karas
    Member

    We would need more information about the crash. I haven't seen this repro anywhere (can't try right now, I don't have ARM64 machine handy).

  15. karelz commented on Feb 10, 2021

    @karelz
    Member

    Perhaps closing then? Until there is more info available?

  16. vitek-karas commented on Feb 10, 2021

    @vitek-karas
    Member

    Agreed - please open a new issue if there's are still issues with the latest .NET 5 (on any platform).

    I also just realized that running dotnet new is not related to single-file, so if that crashed it's definitely a different issue than the one described above.

  17. whatevergeek commented on Feb 11, 2021

    @whatevergeek

    what other info you need? I was able to reproduce it on ARM aarch64... i'm running debian on userland...

  18. vitek-karas commented on Feb 11, 2021

    @vitek-karas
    Member

    Thanks for more info @whatevergeek :

    • What version of .NET you're using (both SDK and runtime - just run dotnet --info)
    • How did you install it (this is mostly interesting if it goes into some uncommon location)
    • What command you run - is it really just dotnet new console or something more involved?
    • What is the OS (although you already answered that one)

    I'll ask somebody to repo it (I don't have ARM64 available at home unfortunately.. yet).

  19. whatevergeek commented on Feb 11, 2021

    @whatevergeek

    hi @vitek-karas ,

    Thanks for considering this.
    Installation is by tarring arm64.tar.gz from the dotnet arm64 site

    I've investigated further and got the following observations:

    TLDR:

    Latest arm64 package (dotnet-sdk-5.0.103-linux-arm64.tar.gz) doesn’t cause segmentation fault anymore when dotnet new is executed. However, build is failing without giving info.

    Exhibit A

    dotnet-sdk-5.0.103: segmentation fault during dotnet new is gone, but build is failing w/o info

    image

    image

    Exhibit B

    Previous version of .NET 5.0 that was working

    image

    image

    Perhaps, segmentation fault is already resolved (or might be hiding since build failure is not showing).
    Anyway, let me know if you or your team need further info.

    I'm really looking forward to use the latest .NET 5.0 on my arm64 device.

  20. vitek-karas commented on Feb 16, 2021

    @vitek-karas
    Member

    @whatevergeek if I understand it correctly this is happening on Linux running in userland (as in https://userland.tech/), right? That is a configuration we don't test as far as I know, so it's not surprising it doesn't work. Feel free to create a new issue to request support for this configuration.

  21. whatevergeek commented on Feb 17, 2021

    @whatevergeek

    hi @vitek-karas ,

    That's correct. I'm using linux via userland.
    Thanks for the consideration.

    I've opened a new issue for this request: #48389

  22. ghost locked as resolved and limited conversation to collaborators on Mar 19, 2021
  23. modified the milestones: Future, 6.0.0 on May 20, 2021
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

    area-System.Net.Socketslinkable-framework

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions