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

normal exit is not clean #16

Closed
mavenlin opened this issue Oct 23, 2015 · 3 comments
Closed

normal exit is not clean #16

mavenlin opened this issue Oct 23, 2015 · 3 comments

Comments

@mavenlin
Copy link

A bug in luajit.
When executing the following,

torch.Tensor.__gc = function() print('gc') end
tensor = torch.Tensor(10)
-- tensor = nil
-- collectgarbage()

at exit 'gc' will not be printed, however when the last two lines of code are uncommented it will print 'gc'.
Which means at exit collectgarbage is not called by the interpreter.
It is a problem when gc writes log to files, or gc disconnects from a server.

@soumith What's your opinion on this?

@soumith
Copy link
Member

soumith commented Oct 24, 2015

@mavenlin it is interesting, and it is a bug in the trepl interpreter (not a bug in luajit).

For example, if you run the script with:
luajit [script.lua]
, you will see that it prints out "gc".
If you run the same with:
th [script.lua]
you dont see the print.

What's the use-case where you ran into this bug? It is likely something minor and not concerning to anything practically relevant.

@mavenlin
Copy link
Author

@soumith In my case I wrapped the parameter server as userdata, gc calls the destructor in C++ side, which notifies the server side of the exit. If it is not gced the server is never notified.

@soumith
Copy link
Member

soumith commented Oct 25, 2015

fixed the issue via torch/trepl#38
Updating your trepl via: "luarocks install trepl" will solve the issue.
I'm updating distro to have this latest fix as well.

Thanks a lot for the report.

@soumith soumith closed this as completed Oct 25, 2015
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