#2651 IOException when tracing the cimxml

Function
closed-fixed
Dave Blaschke
jsr48-client
3
2013-09-19
2013-07-18
Samuel
No

A IOException is got when tracing the cimxml:

java.io.IOException: Stream Closed
at java.io.FileOutputStream.write(FileOutputStream.java:316)
at org.sblim.cimclient.internal.wbem.WBEMClientCIMXML.transmitRequestWorker(WBEMClientCIMXML.java:1909)
at org.sblim.cimclient.internal.wbem.WBEMClientCIMXML.transmitRequest(WBEMClientCIMXML.java:1814)
at org.sblim.cimclient.internal.wbem.WBEMClientCIMXML.getClass(WBEMClientCIMXML.java:1262)

The cause is that:the cimxml trace stream is closed by one client, but other clients still use this steam to trace.

5 Attachments

Discussion

1 2 3 > >> (Page 1 of 3)
  • Dave Blaschke
    Dave Blaschke
    2013-07-18

    Currently, WBEMClient.close() closes the iCimXmlTraceFile IF AND ONLY IF it opens the stream. This leaves LogAndTraceBroker.getXmlTraceStream() returning a non-null value to other clients because LogAndTraceBroker is a static instance, and exceptions then occur when other clients attempt to trace XML.

    The close() method should at the very least LogAndTraceBroker.setXmlTraceStream(null) before closing iCimXmlTraceFile to avoid the exceptions.

    I will endeavor to look for a better solution.

     
  • Rick Blasiak
    Rick Blasiak
    2013-07-18

    I am out of the office until 07/22/2013.

    For CME-CIM technical issues contact Prashant Bhosale or Tom Phelan

    Or contact my manager: Carmen Blackley

    I will not have access to Notes during my absence

    Note: This is an automated response to your message "[sblim:bugs] #2651
    IOException when tracing the cimxml" sent on 07/18/2013 12:17:46.

    This is the only notification you will receive while this person is away.

     
  • Dave Blaschke
    Dave Blaschke
    2013-07-18

    I have a few ideas that DON'T involve making LogAndTraceBroker non-static, but need to discuss how you are using XML tracing. Please contact me via Sametime.

     
  • Dave Blaschke
    Dave Blaschke
    2013-07-19

    Proposed patch keeps track of a trace file, if opened, and closes it when the last WBEMClient instance is closed

     
  • Dave Blaschke
    Dave Blaschke
    2013-07-23

    The underlying problem is that LogAndTraceBroker is static, so there is only one CIM-XML trace file allowed per JRE. So, no matter how many WBEMClients are tracing, when the first one exits, it will close the file which leads to an IOException the next time another WBEMClient attempts to log its trace.

    The best solution would be to have each WBEMClient have its own LogAndTraceBroker, but that would be a very sizable change AND could lead to other issues ("Some platforms, in particular, allow a file to be opened for writing by only one FileOutputStream (or other file-writing object) at a time"). This solution just changes the WBEMClient.iCimXmlTraceFile field to static and closes it when the last WBEMClient instance is closed.

     
  • Dave Blaschke
    Dave Blaschke
    2013-07-23

    • status: open --> open-fixed
     
  • Dave Blaschke
    Dave Blaschke
    2013-07-23

    Patch sent for community review. During a 2 week period any exploiter may comment on the patch, request changes or turn it down completely (with good reason). For the time being the patch is part of the "Experimental" branch in CVS.

     
  • Dave Blaschke
    Dave Blaschke
    2013-07-25

    From Samuel:

    I check the code again, i found that the synchronized is using the object as a lock

    so this works well for multi-thread per WBEMClient object case

    but i'm not sure whether it works for multi-thread of multi WBEMClient object case

    moving the OutputStream to LogAndTraceBroker should work

     
  • Dave Blaschke
    Dave Blaschke
    2013-07-25

    • status: open-fixed --> open
     
  • Dave Blaschke
    Dave Blaschke
    2013-07-25

    Patch backed out, community review over

     
1 2 3 > >> (Page 1 of 3)