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

log4erl hangs on application:stop(log4erl). #1

Closed
maxlapshin opened this issue Dec 22, 2009 · 12 comments
Closed

log4erl hangs on application:stop(log4erl). #1

maxlapshin opened this issue Dec 22, 2009 · 12 comments

Comments

@maxlapshin
Copy link

Haven't you met such a problem?

@ddossot
Copy link

ddossot commented Dec 25, 2009

We haven't met this problem, though we call application:stop(log4erl) as part of our normal application shutdown (which happens many time per day, as per our integration tests).

Using: log4erl master, file and console appenders + one custom appender.
Running on: R13B01, ERTS 5.7.2, Ubuntu Karmic.

@ahmednawras
Copy link
Owner

Hi maxlapshin,

I'm not sure I understand you complain here. Is this something you face a lot? Is there an error message you get for example? Can you please provide a sample code? I use log4erl a lot with different OSes (Solaris, linux, win) and don't recall a time when I faced such an issue.

@maxlapshin
Copy link
Author

So, it seems, that I don't understand where to put application:stop(log4erl). =(

I call application:start(log4erl) in ems_app:start/2 callback and call application:stop(log4erl) in ems_app:stop/1 callback. Am I doing wrong?

@maxlapshin
Copy link
Author

Yes, I've found: it is my fail, I shouldn't stop log4erl from stop/1 callback of main application.

@ahmednawras
Copy link
Owner

Hi maxlapshin,

That's what I normally do, call application:stop(log4erl) from my applications's stop function. Can you please explain what is the cause of failure in your side and how it was resolved?

Ahmed

@maxlapshin
Copy link
Author

http://github.com/erlyvideo/erlyvideo/commit/bb69a955491e32f462985f6517d56bc12f3dce47

I had to move application:stop(log4erl) from ems_app.erl (application handler) to ems.erl (generic module) and hangs disappeared.

@ahmednawras
Copy link
Owner

Perfect. I will close this case now.

@maxlapshin
Copy link
Author

And what is the problem? I have the same hang with my erlang-rtmp application/library

@ahmednawras
Copy link
Owner

Hi maxlapshin,

I reopened this case again. I'm not sure of the exact reason for the hangs but below you can find my analysis.

I've done a quick review for ems.erl, ems_app.erl and ems_log.erl and found out that you start log4erl and stop it in different modules. Also, I could see in some modules you stop and unload log4erl (ems.erl) and in other you just stop it (ems_log.erl). I suspect this is due to the issue of log4erl hanging.

I suggest you add application:start(log4erl) and application:stop(log4erl) in the same module only and delete the rest. Also, make sure you start before any other log4erl dependant code and stop after it. My initial guess is that this place is ems_log.erl, unless you're using log4erl logging before you actually initialize ems_log.erl module.

I don't normally use application:unload/1 but you may have your own reasoning for using it. If you opt to using it, I'd recommend you also add application:load/1 before application:start/1 just in case.

Please try it again and let me know if you still have problems.

Ahmed

@maxlapshin
Copy link
Author

Yes, I will try of course, thank you for review.

@ahmednawras
Copy link
Owner

Closing

@maxlapshin
Copy link
Author

Yes, close it, thank you again for help.

This issue was closed.
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

3 participants