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

Error messages are sometimes not displayed #6115

Closed
esope opened this issue Sep 3, 2022 · 14 comments · Fixed by #6119
Closed

Error messages are sometimes not displayed #6115

esope opened this issue Sep 3, 2022 · 14 comments · Fixed by #6119
Assignees
Milestone

Comments

@esope
Copy link
Collaborator

esope commented Sep 3, 2022

Sometimes, error messages are not displayed at all when dune is run from a terminal.
If you redirect stderr to a file, however, then the error messages are correctly written to that file.
This bug seems to happen on the dev version of dune only.
I was not able to create a test that witnesses this behavior: tests seem to redirect stderr.

Expected Behavior

Whether stderr is redirected or not, the same error messages should be produced (with the exception of styles and colors, maybe).

Actual Behavior

It happens sometimes that dune command args produces no visible error messages, but dune command args 2> errors.txt writes some error messages to the file errors.txt.

Reproduction

dune describe bug displays no message at all.

dune describe bug 2> errors.txt writes the error message Error: Unknown constructor bug to errors.txt as expected.

Specifications

  • Version of dune: dev version, with git hash 87bc1bfa16136a9f8833e236c23b8454a309e55e
  • Version of ocaml: 4.14.0
  • Operating system (distribution and version): Linuxmint 21
@emillon
Copy link
Collaborator

emillon commented Sep 5, 2022

I've seen that too, I'll investigate

@emillon emillon self-assigned this Sep 5, 2022
@emillon emillon added this to the 3.5.0 milestone Sep 5, 2022
@emillon
Copy link
Collaborator

emillon commented Sep 5, 2022

That has been introduced in #6068

@emillon emillon assigned rgrinberg and unassigned emillon Sep 5, 2022
@emillon
Copy link
Collaborator

emillon commented Sep 5, 2022

@rgrinberg it's probably more efficient if you have a look at this one - looks like we're missing a flush on stderr at the end.

@rgrinberg
Copy link
Member

Np. Should be simple enough to fix. I'll manually shut down the UI thread once the Term.t finishes executing.

@esope
Copy link
Collaborator Author

esope commented Sep 6, 2022

Fixed by #6119

@emillon emillon linked a pull request Sep 6, 2022 that will close this issue
@gridbugs
Copy link
Collaborator

Heads up that I'm still encountering this while building dune on an M1 Mac.

@gridbugs gridbugs reopened this Dec 26, 2022
@gridbugs
Copy link
Collaborator

I see this on both macOS and dockerized ubuntu, and I see it when I build non-dune projects as long as I'm using a dune which I build from source. I don't see this error using 3.6.1 installed from opam.

@gridbugs
Copy link
Collaborator

Bisected and the problem was introduced in this commit 1f518fb

@gridbugs
Copy link
Collaborator

This seems to fix the problem:

diff --git a/src/dune_console/dune_console.ml b/src/dune_console/dune_console.ml
index f233e4637..22aab51fb 100644
--- a/src/dune_console/dune_console.ml
+++ b/src/dune_console/dune_console.ml
@@ -304,9 +304,9 @@ module Backend = struct
         Base.start ();
         while true do
           Mutex.lock mutex;
+          Base.render state;
           let finish_requested = state.finish_requested in
           if finish_requested then raise_notrace Exit;
-          Base.render state;
           Mutex.unlock mutex;
           let now = Unix.gettimeofday () in
           let elapsed = now -. !last in

@esope
Copy link
Collaborator Author

esope commented Jan 8, 2023

@rgrinberg @Alizter it seems that 1f518fb is your commit.
Do you want to have a look at this issue?

@Alizter
Copy link
Collaborator

Alizter commented Jan 8, 2023

@esope that commit has since been reverted.

@esope
Copy link
Collaborator Author

esope commented Jan 9, 2023

Oh, OK. My bad.
@gridbugs do you still observe the bug with a dune version close to tip?

@gridbugs
Copy link
Collaborator

I no longer observe the bug on tip (715825e)

@esope
Copy link
Collaborator Author

esope commented Jan 11, 2023

Great. I am closing the issue, then. Do not hesitate to reopen it if necessary.

@esope esope closed this as completed Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants