question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] System browser process on Linux writes junk to standard out/error

See original GitHub issue

See the original issue: https://github.com/microsoft/Git-Credential-Manager-Core/issues/286

Logs and Network traces

Which Version of MSAL are you using ? 4.3.0

Platform netcoreapp3.1

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive - system browser

Is this a new or existing app? b. The app is in production, I haven’t upgraded MSAL, but started seeing this issue

Repro On Linux, create a new console app, set Chromium set as your default browser and open an existing tab:

var pca = BuildPublicClientApplication();
var result = await pca.AcquireTokenInteractive().ExecuteAsync();

Expected behavior A new tab is opened to the authentication page; nothing is written to the console.

Actual behavior Text is written to the console.

Possible Solution Detach/redirect stdout & err from the child process when launching a browser on Linux.

Additional context/ Logs / Screenshots The problem appears to be the use of Process.Start when opening the URL on Linux. The .NET Core BCL uses xdg-open (amongst others) to start the new process/default browser, but it does not detach the standard in/out/err streams from the calling process. This means anything written by the browser (e.g., Chromium) or xdg-open will be written to the entry process’ streams!

In GCM, who is invoked by Git, we must communicate back to Git over the standard output stream, and this noise is causing issues.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pmaytakcommented, Apr 22, 2021

This is included in MSAL 4.30.0 release.

cc: @mjcheetham

0reactions
mjcheethamcommented, Mar 29, 2021

Hi @pmaytak I’ve just tried the new package out, and this still does not fix the issue (see my reply on the PR).

If you’re looking for a repro, here’s the smallest one:

namespace TestApp
{
    class Program
    {
        public static async Task Main(string[] args)
        {
            const string clientId = "872cd9fa-d31f-45e0-9eab-6e460a02d1f1";
            string[] scopes = new { "User.Read" };
            var pca = PublicClientApplicationBuilder.Create(clientId)
                .WithRedirectUri("http://localhost")
                .Build();
            var result = await pca.AcquireTokenInteractive(scopes).ExecuteAsync();
        }
    }
}
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Identity.Client" Version="4.28.1" />
  </ItemGroup>
</Project>
$ dotnet run

(chrome:21189): Gtk-WARNING **: 13:58:53.285: Theme parsing error gtk.css:1565.23: 'font-feature-settings' is not a valid property name

(chrome:21189): Gtk-WARNING **: 13:58:53.289: Theme parsing error gtk.css:3615.25: 'font-feature-settings' is not a valid property name

(chrome:21189): Gtk-WARNING **: 13:58:53.290: Theme parsing error gtk.css:4077.23: 'font-feature-settings' is not a valid property name
Opening in existing browser session.

☝️ those messages to standard out/error should not be written.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Failed to launch the browser process puppeteer
So I first went into node_modules/puppeteer/.local-chromium/linux-737027/ and found a zip file named chrome-linux.zip containing a folder named ...
Read more >
Bugs in Hello World
The script that my BROWSER script calls has some debug output that it prints to stderr. I use mutt as my email client...
Read more >
Linux Redirect Error Output To File
I am a new Ubuntu Linux and bash shell user. ... discarded by your system. This is useful to silence out errors (also...
Read more >
Top 3 Ways to Fix “No Space Left on Device” Error in Linux
Since the system fails to write any files to these locations, it throws an error. Fix 1: Restart Processes Using Deleted Files. The...
Read more >
Datastore inconsistency error obtaining "InputStream for blobId"
This error means that you are possibly missing files from your Adobe Experience Manager datastore directory. The loss of datastore files can be ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found