bwsw edited a comment on issue #3838: CS 4.11.2+ SSVM bug when scanning 
templates
URL: https://github.com/apache/cloudstack/issues/3838#issuecomment-578567405
 
 
   I found how the bug can be traced:
   
   1st: let's look at 
[execute](https://github.com/apache/cloudstack/blob/master/utils/src/main/java/com/cloud/utils/script/Script.java#L210)
 which launches template lister.
   
   It first launches process and next launches executor task which gathers 
output with a timeout.
   
   2nd: let's look at 
[TimedOutLogger](https://github.com/apache/cloudstack/blob/master/utils/src/main/java/com/cloud/utils/script/OutputInterpreter.java#L52)
 which is used to get logs.
   
   The implementation is probably wrong, as it doesn't assume that first state 
for reader is `not ready`. It assumes that it's initially `ready`, but `ready` 
is when the process returned something, if it didn't then it's not ready... and 
it terminates the process.
   
   So, next look at 
[Task](https://github.com/apache/cloudstack/blob/1d05fead49f5c856257a741b07122f5633d2e359/utils/src/main/java/com/cloud/utils/script/Script.java#L328)
 implementation. It includes notifyAll, which interrupts the thread and causes 
[TimedOutLogger](https://github.com/apache/cloudstack/blob/1d05fead49f5c856257a741b07122f5633d2e359/utils/src/main/java/com/cloud/utils/script/Script.java#L270)
 is run in task.
   
   Aannd.... if the script didn't return the data when the task where 
TimedOutLogger is launched, it's terminated by TimedOutLogger.
   
   As for me the implementation is very spoiled and should be reimplemented. 
It's a critical bug for ssvm which is acting when the script is slow, which is 
a normal case for large secondary storages or simply when under load.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to