You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by "Michael McCandless (JIRA)" <ji...@apache.org> on 2009/03/13 19:01:56 UTC

[jira] Created: (PYLUCENE-1) On unhandled exception into Python, the Java stack trace should be included, and vice/versa

On unhandled exception into Python, the Java stack trace should be included, and vice/versa
-------------------------------------------------------------------------------------------

                 Key: PYLUCENE-1
                 URL: https://issues.apache.org/jira/browse/PYLUCENE-1
             Project: PyLucene
          Issue Type: Improvement
            Reporter: Michael McCandless
            Priority: Minor


Spinoff from this thread:

  http://markmail.org/message/lupg3umtwl6wopoj

When an unhandled exception escapes Java into python, you get a JavaError python object.  When this exception is unhandled in Python, you get something like this printed to your stderr:

You are able to get the stack trace from java:

{code}
Traceback (most recent call last):
  File "testFieldReuse.py", line 22, in <module>
    go()
  File "testFieldReuse.py", line 18, in go
    writer.addDocument(doc)
lucene.JavaError: java.lang.NullPointerException
{code}

But if you call JavaError.getJavaException().printStackTrace(), you see the full trace:

{code}
java.lang.NullPointerException
	at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:81)
	at org.apache.lucene.index.DocFieldConsumersPerField.processFields(DocFieldConsumersPerField.java:36)
	at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.java:234)
	at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:765)
	at org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1917)
	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1895)
{code}

Ideally, somehow (and I'm quite hazy on that), we want better integration so that you'll see the java part of the traceback, and vice/versa when a Python exception escapes into Java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PYLUCENE-1) On unhandled exception into Python, the Java stack trace should be included, and vice/versa

Posted by "Andi Vajda (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PYLUCENE-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721628#action_12721628 ] 

Andi Vajda commented on PYLUCENE-1:
-----------------------------------

In rev 786355, I fixed half of this issue by including the java stacktrace into the string representation of the object wrapping java errors, instances of JavaError.
The second half of this bug, including a Python stacktrace when reporting an error to Java remains to be considered.

> On unhandled exception into Python, the Java stack trace should be included, and vice/versa
> -------------------------------------------------------------------------------------------
>
>                 Key: PYLUCENE-1
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-1
>             Project: PyLucene
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Priority: Minor
>
> Spinoff from this thread:
>   http://markmail.org/message/lupg3umtwl6wopoj
> When an unhandled exception escapes Java into python, you get a JavaError python object.  When this exception is unhandled in Python, you get something like this printed to your stderr:
> You are able to get the stack trace from java:
> {code}
> Traceback (most recent call last):
>   File "testFieldReuse.py", line 22, in <module>
>     go()
>   File "testFieldReuse.py", line 18, in go
>     writer.addDocument(doc)
> lucene.JavaError: java.lang.NullPointerException
> {code}
> But if you call JavaError.getJavaException().printStackTrace(), you see the full trace:
> {code}
> java.lang.NullPointerException
> 	at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:81)
> 	at org.apache.lucene.index.DocFieldConsumersPerField.processFields(DocFieldConsumersPerField.java:36)
> 	at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.java:234)
> 	at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:765)
> 	at org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
> 	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1917)
> 	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1895)
> {code}
> Ideally, somehow (and I'm quite hazy on that), we want better integration so that you'll see the java part of the traceback, and vice/versa when a Python exception escapes into Java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (PYLUCENE-1) On unhandled exception into Python, the Java stack trace should be included, and vice/versa

Posted by Andi Vajda <va...@apache.org>.
  > Presumably the half you've fixed is the most important one?  Ie, usually
  > one gets unhandled Java exceptions up through Python, less commonly
  > vice/versa, when using PyLucene.

That is correct. You'd get a Python exception in Java when "extending" a 
Java class from Python. You'd most likely get the exception back to Python 
by way of Java but it is still probable that the original stacktrace would 
get lost. I need to at least investigate this case before calling this bug 
fixed entirely.

[jira] Commented: (PYLUCENE-1) On unhandled exception into Python, the Java stack trace should be included, and vice/versa

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PYLUCENE-1?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721715#action_12721715 ] 

Michael McCandless commented on PYLUCENE-1:
-------------------------------------------

Presumably the half you've fixed is the most important one?  Ie, usually one gets unhandled Java exceptions up through Python, less commonly vice/versa, when using PyLucene.

> On unhandled exception into Python, the Java stack trace should be included, and vice/versa
> -------------------------------------------------------------------------------------------
>
>                 Key: PYLUCENE-1
>                 URL: https://issues.apache.org/jira/browse/PYLUCENE-1
>             Project: PyLucene
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Priority: Minor
>
> Spinoff from this thread:
>   http://markmail.org/message/lupg3umtwl6wopoj
> When an unhandled exception escapes Java into python, you get a JavaError python object.  When this exception is unhandled in Python, you get something like this printed to your stderr:
> You are able to get the stack trace from java:
> {code}
> Traceback (most recent call last):
>   File "testFieldReuse.py", line 22, in <module>
>     go()
>   File "testFieldReuse.py", line 18, in go
>     writer.addDocument(doc)
> lucene.JavaError: java.lang.NullPointerException
> {code}
> But if you call JavaError.getJavaException().printStackTrace(), you see the full trace:
> {code}
> java.lang.NullPointerException
> 	at org.apache.lucene.index.DocInverterPerField.processFields(DocInverterPerField.java:81)
> 	at org.apache.lucene.index.DocFieldConsumersPerField.processFields(DocFieldConsumersPerField.java:36)
> 	at org.apache.lucene.index.DocFieldProcessorPerThread.processDocument(DocFieldProcessorPerThread.java:234)
> 	at org.apache.lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java:765)
> 	at org.apache.lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:743)
> 	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1917)
> 	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java:1895)
> {code}
> Ideally, somehow (and I'm quite hazy on that), we want better integration so that you'll see the java part of the traceback, and vice/versa when a Python exception escapes into Java.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.