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

print causes hang #15

Closed
chris-b1 opened this issue Jan 6, 2021 · 4 comments
Closed

print causes hang #15

chris-b1 opened this issue Jan 6, 2021 · 4 comments

Comments

@chris-b1
Copy link

chris-b1 commented Jan 6, 2021

Running the example below through DaemonMode causes a hang and the following output after a Ctrl+c. This does not happen if I use println instead of print

# repro.jl
print("Hello world")
λ julia --startup-file=no --project=. -e "using DaemonMode; runargs()" repro.jl
hello worldDaemonMode::end
# <Ctrl + c>
Error, cannot connect with server. Is it running?

This is on Windows 10, Julia 1.5, DaemonMode 0.1.1

@dmolina
Copy link
Owner

dmolina commented Jan 7, 2021

It seems that the juliaserver is not running, have you do the following?

λ julia --startup-file=no --project=. -e "using DaemonMode; serve()" 

previously in another term? The idea is that there is running the server in one process or terminal, and them you run several times runargs() with the file[s] to run. The server is actually which run these files, to accelerate the time, because all functions and packages have been previously run.

@chris-b1
Copy link
Author

chris-b1 commented Jan 7, 2021

Thanks for the reply @dmolina.

Yes, the server is running. When it's not running I get a graceful exit and error message, when it is running it hangs after running repro.jl

I'll take a closer look - given that this happens only with a print and not println I wonder if there's an assumption of a newline somewhere in the stdout handling

@chris-b1
Copy link
Author

chris-b1 commented Jan 7, 2021

server

m = Module()
add_include = Meta.parse("include(arg)=Base.include(@__MODULE__,arg)")
Base.eval(m, add_include)
run(m)
end
println(sock, token_end)

client

while (line != token_end)
println(output, line)
line = readline(sock)
end

The issue is that if run doesn't end outputting a newline, the last line of the program output will also contain the token_end.

@dmolina
Copy link
Owner

dmolina commented Jan 7, 2021

Yes, you are right. I have checked now and fixed it in the current master version. I am adding a few new functionality, when I will have I submit a new version. However, now in the master version it is fixed.
Thank you a lot for your feedback!

@chris-b1 chris-b1 closed this as completed Jan 7, 2021
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

No branches or pull requests

2 participants