GithubHelp home page GithubHelp logo

Comments (22)

yegor256 avatar yegor256 commented on September 25, 2024

I don't get, what exactly is a problem and how to reproduce it?

from jcabi-log.

longtimeago avatar longtimeago commented on September 25, 2024

@yegor256 Well, I know how it looks in thindeck project.

  1. Switch thindeck project on jcabi-log 0.15
  2. 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.

yegor256 avatar yegor256 commented on September 25, 2024

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.

longtimeago avatar longtimeago commented on September 25, 2024

@yegor256 You are right

from jcabi-log.

longtimeago avatar longtimeago commented on September 25, 2024

@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.

yegor256 avatar yegor256 commented on September 25, 2024

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.

longtimeago avatar longtimeago commented on September 25, 2024

ok, I'll try to reproduce it

from jcabi-log.

longtimeago avatar longtimeago commented on September 25, 2024

@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 VerboseProcessknows 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:

  1. [jcabi-log] VerboseProcess should be responsible for closing 2 internal monitors and then closing decorated process. IMHO, good idea if VerboseProcess would implement Closable
  2. [jcabi-ssh] Make SSHD.close() to call VerboseProcess.close instead of Process.destroy

What do you think?

from jcabi-log.

yegor256 avatar yegor256 commented on September 25, 2024

sounds interesting indeed. let's change the description of the ticket and make VerboseProcess closeable

from jcabi-log.

dmarkov avatar dmarkov commented on September 25, 2024

I'll find a developer for the task soon...

from jcabi-log.

dmarkov avatar dmarkov commented on September 25, 2024

thanks for this report, I added 15 mins to your account, in transaction 46857728

from jcabi-log.

longtimeago avatar longtimeago commented on September 25, 2024

@yegor256 Can someone take care of the issue?

from jcabi-log.

yegor256 avatar yegor256 commented on September 25, 2024

@dmarkov please assign @carlosmiranda to this task

from jcabi-log.

dmarkov avatar dmarkov commented on September 25, 2024

@dmarkov please assign @carlosmiranda to this task

@yegor256 OK @carlosmiranda please proceed, this task is yours

from jcabi-log.

carlosmiranda avatar carlosmiranda commented on September 25, 2024

@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.

longtimeago avatar longtimeago commented on September 25, 2024

@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.

carlosmiranda avatar carlosmiranda commented on September 25, 2024

Pull request submitted at #42.

from jcabi-log.

carlosmiranda avatar carlosmiranda commented on September 25, 2024

@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.

longtimeago avatar longtimeago commented on September 25, 2024

@carlosmiranda sure, thank you very much!

from jcabi-log.

dmarkov avatar dmarkov commented on September 25, 2024

@carlosmiranda 30 mins was added to your account, many thanks for your contribution!

from jcabi-log.

dmarkov avatar dmarkov commented on September 25, 2024

once 38-9367cb1e puzzle is resolved, this ticket will be complete

from jcabi-log.

dmarkov avatar dmarkov commented on September 25, 2024

the last puzzle 38-9367cb1e/#46 solved

from jcabi-log.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.