Copy module's deepcopy method hangs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Copy module's deepcopy method hangs

sjlucas
Hi,

I have a Java application that embeds Jython.  The Java application executes a Jython function repeatedly (I included a snippet of part of what this Jython function does below).  Randomly, after being executed sometimes thousands of times, it will start hanging whenever it calls the Jython copy module's deepcopy method (as it never prints "End deepcopy").  Could the deepcopy method be in some kind of recursive loop?  Does anyone have any idea of why this is happening and how I can fix it?  Could it be a bug in the Jython deepcopy method?  I've run my application with Jython 2.5.2 and Jython 2.5.4 rc1 and the problem occurs using both Jython versions.

  try:
     print 'Begin deepcopy'
     STAXclone[STAXkeyName] = copy.deepcopy(STAXclone[STAXkeyName])

      print 'End deepcopy'
 except:
     print 'Ignore types that cannot be deep copied'


I've seen the hang occur when performing a deepcopy of a Python variable with type 'NoneType'.
My Java application is running on a Linux 64-bit system using Java 1.6.0 64-bit.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   [hidden email]
(512) 286-7313 or Tieline 363-7313

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|

Re: Copy module's deepcopy method hangs

Jim Baker-2
Sharon,

As usual we would want a small test to reproduce this fault, with no dependencies on the STAX code.

However, some thoughts:

1. Jython 2.5 and 2.7 both use without modification the copy module from the CPython standard library, given that it is pure Python. However, there were some updates around deepcopy that were in 2.7. So it's worthwhile trying Jython 2.7 if you can.

2. The hanging problem you have is just the sort of issue that one might get from concurrent modification on mutable data structures, if they are not thread safe, so please check that is not the case. copy.deepcopy needs to maintain a memo table, and it does nothing to maintain thread safety of that structure.

- Jim

On Wed, Oct 8, 2014 at 3:27 PM, Sharon Lucas <[hidden email]> wrote:
Hi,

I have a Java application that embeds Jython.  The Java application executes a Jython function repeatedly (I included a snippet of part of what this Jython function does below).  Randomly, after being executed sometimes thousands of times, it will start hanging whenever it calls the Jython copy module's deepcopy method (as it never prints "End deepcopy").  Could the deepcopy method be in some kind of recursive loop?  Does anyone have any idea of why this is happening and how I can fix it?  Could it be a bug in the Jython deepcopy method?  I've run my application with Jython 2.5.2 and Jython 2.5.4 rc1 and the problem occurs using both Jython versions.

  try:
     print 'Begin deepcopy'
     STAXclone[STAXkeyName] = copy.deepcopy(STAXclone[STAXkeyName])

      print 'End deepcopy'
 except:
     print 'Ignore types that cannot be deep copied'


I've seen the hang occur when performing a deepcopy of a Python variable with type 'NoneType'.
My Java application is running on a Linux 64-bit system using Java 1.6.0 64-bit.

--------------------------------------------------------------
Sharon Lucas
IBM Austin,   [hidden email]
<a href="tel:%28512%29%20286-7313" value="+15122867313" target="_blank">(512) 286-7313 or Tieline 363-7313

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users




--

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users