Comments (22)
I don't get, what exactly is a problem and how to reproduce it?
from jcabi-log.
@yegor256 Well, I know how it looks in thindeck project.
- Switch thindeck project on jcabi-log 0.15
- Run the build
You will see a lot of such exceptions in traces (build would still pass).
How to reproduce it in jcabi-log project? I don't know.
I just try to be proactive and don't wait for the problem would be seen in thindeck/other_proj master
from jcabi-log.
if it's not reproducible here, how do you know the problem is related to jcabi-log? we should find a way to reproduce it here, then we can fix...
from jcabi-log.
@yegor256 You are right
from jcabi-log.
@yegor256 So, are we going to take care of the issue? Should I close it? Is there anything I can do here as a reporter?
from jcabi-log.
it's up to you. if you can find a way to reproduce it, please post it here, we'll turn into a real "bug" and someone will fix it. if you can't find a way, just close it.
from jcabi-log.
ok, I'll try to reproduce it
from jcabi-log.
@yegor256 I think I understand what is the problem.
We observe the exception because we are trying to read from stream but it's closed. Why is it closed? Because process was destroyed!
Take a look at NginxTest.createsHostsConfiguration
https://github.com/yegor256/thindeck/blob/master/src/test/java/com/thindeck/steps/NginxTest.java#L137
We call sshd.stop();
which is https://github.com/jcabi/jcabi-ssh/blob/master/src/main/java/com/jcabi/ssh/SSHD.java#L146 this.process.destroy();
So, process is destroyed, but decorator VerboseProcess
knows nothing about that! That's why it's internal monitors fail to read from closed stream.
How to fix that?
There are two points of fix:
- [jcabi-log]
VerboseProcess
should be responsible for closing 2 internal monitors and then closing decorated process. IMHO, good idea ifVerboseProcess
would implementClosable
- [jcabi-ssh] Make
SSHD.close()
to callVerboseProcess.close
instead ofProcess.destroy
What do you think?
from jcabi-log.
sounds interesting indeed. let's change the description of the ticket and make VerboseProcess
closeable
from jcabi-log.
I'll find a developer for the task soon...
from jcabi-log.
thanks for this report, I added 15 mins to your account, in transaction 46857728
from jcabi-log.
@yegor256 Can someone take care of the issue?
from jcabi-log.
@dmarkov please assign @carlosmiranda to this task
from jcabi-log.
@dmarkov please assign @carlosmiranda to this task
@yegor256 OK @carlosmiranda please proceed, this task is yours
from jcabi-log.
@longtimeago I'm not sure I follow how this will resolve the problem. The monitors are daemon threads and not executors, so they're not "closeable" either. However they will throw an exception, if the process is destroyed since the streams will be closed. It's also possible for the process to end without destroy()
being called on it.
That said, I don't know of a way to determining "elegantly" whether the process itself has terminated. We can call process.exitValue()
and see if it throws an exception, but that's an ugly way to do it. :(
What do you think?
from jcabi-log.
@carlosmiranda Let's get the light.
Main goal - make VerboseProcess
closable. When VerboseProcess
client call VerboseProcess.close()
VerboseProcess
should gracefully stop it's monitors and THEN call destroy()
on wrapped process. So far so good?
You are right, monitors are daemon threads. To gracefully stop them we need to create a Thread which can be stopped from outside (see http://www.java2s.com/Code/Java/Threads/Thesafewaytostopathread.htm for example).
We would also have to store those monitor threads as fields in VerboseProcess
.
from jcabi-log.
Pull request submitted at #42.
from jcabi-log.
@longtimeago it's now closable in #42. Issue with monitor threads will be continued in a puzzle. Can we close this now?
from jcabi-log.
@carlosmiranda sure, thank you very much!
from jcabi-log.
@carlosmiranda 30 mins was added to your account, many thanks for your contribution!
from jcabi-log.
once 38-9367cb1e
puzzle is resolved, this ticket will be complete
from jcabi-log.
the last puzzle 38-9367cb1e
/#46 solved
from jcabi-log.
Related Issues (20)
- Upgrading parent in pom.xml from 1.20.1 to 1.23 and fixing checkstyle errors causes PMD errors. HOT 6
- Add example log output HOT 3
- VerboseProcessTest.java:52-55: Locale/encoding problem in two test... HOT 1
- Logger.format() can't process args with positions HOT 30
- SupplierLoggerTest.java:43-45: Some tests here are... HOT 1
- DomDecor: why is object allowed to be passed to ctor? HOT 1
- Logger fails to build complex strings with positional substitutes HOT 8
- [nano] decor example is not working HOT 3
- let's get rid of aspects HOT 8
- All jcabi libraries are not working with JDK13 because logger uses invalid refrelction access HOT 3
- let's use latest version of SLF4j API HOT 6
- slf4j 2.0 HOT 12
- fresh release HOT 3
- refresh HOT 3
- Dependency Dashboard
- depends on mockito-core as compile scope, is a mistake? HOT 7
- fresh release HOT 3
- FileDecor HOT 8
- 'other' has different root HOT 8
- log the entire command in `VerboseProcess` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jcabi-log.