Modify

Opened 17 years ago

Closed 15 years ago

#2008 closed defect (wontfix)

XML RPC Plugin create Ticket return non standard Integer Type (PostgresSQL specifc type)

Reported by: chrisky.c@… Owned by: Alec Thomas
Priority: normal Component: XmlRpcPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description (last modified by osimons)

This was originally submitted to Eclipse's Bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=202230)

Its been commented may be the createTicket in XMLRPC are returning PostgreSQL specific number type (non standard Integer) which cause the problem.

Steps To Reproduce:

  1. Try to create an TRAC Repository New Task using XMLRPCPlugin
  2. When click on "Create New", the EDITOR keep unsaved status with the ERROR message "Unable to submit at this time. Check connectivity and retry."
  3. TICKET(Task) was actually created on TRAC with generated ID

This log was generated during this error

!ENTRY org.eclipse.mylyn.trac.core 4 5 2007-09-05 11:59:48.962
!MESSAGE 'cannot marshal <type 'PgInt8'> objects' while executing
'ticket.create()'
!STACK 0
org.eclipse.mylyn.internal.trac.core.TracRemoteException: 'cannot marshal <type
'PgInt8'> objects' while executing 'ticket.create()'
        at
org.eclipse.mylyn.internal.trac.core.TracXmlRpcClient.callInternal(TracXmlRpcClient.java:182)
        at
org.eclipse.mylyn.internal.trac.core.TracXmlRpcClient.call(TracXmlRpcClient.java:127)
        at
org.eclipse.mylyn.internal.trac.core.TracXmlRpcClient.createTicket(TracXmlRpcClient.java:603)
        at
org.eclipse.mylyn.internal.trac.core.TracTaskDataHandler.postTaskData(TracTaskDataHandler.java:332)
        at
org.eclipse.mylyn.tasks.ui.editors.AbstractRepositoryTaskEditor$37.run(AbstractRepositoryTaskEditor.java:2754)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: org.apache.xmlrpc.XmlRpcException: 'cannot marshal <type 'PgInt8'>
objects' while executing 'ticket.create()'
        at
org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:184)
        at
org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:145)
        at
org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:94)
        at
org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:53)
        at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:166)
        at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:136)
        at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:125)
        at
org.eclipse.mylyn.internal.trac.core.TracXmlRpcClient.callInternal(TracXmlRpcClient.java:169)
        ... 5 more

More information: Trac 10.3 with PostgresSQL 8.2.3

Attachments (0)

Change History (7)

comment:1 Changed 17 years ago by Alec Thomas

To track this down we'll need a backtrace from Trac.

comment:2 in reply to:  1 Changed 17 years ago by anonymous

Replying to athomas:

To track this down we'll need a backtrace from Trac.

How do i generate the backtrace?

I have enable the logging under trac.ini [logging] log_file = trac.log log_level = DEBUG log_type = file

but trac.log show nothing special..

2007-09-07 04:39:53,805 Trac[loader] DEBUG: Loading egg plugin TracXMLRPC from / export/home/opt/csw/lib/python2.3/site-packages/TracXMLRPC-0.1-py2.3.egg 2007-09-07 04:39:54,050 Trac[cache] INFO: Syncing with repository (None to 0)

comment:3 Changed 17 years ago by Steffen Pingel

Description: modified (diff)

Alec, I suspect that the ticket id in the create() method is not converted to an int but has a PostgresSQL specific integer type causing the error. I can't test it since I don't have a working PostgreSQL environment.

Kai, could you try to apply the following patch which adds an explicit type conversion before returning the ticket id to your Trac XML-RPC plug-in:

Index: tracrpc/ticket.py
===================================================================
--- tracrpc/ticket.py   (revision 2617)
+++ tracrpc/ticket.py   (working copy)
@@ -90,7 +90,7 @@
                 self.log.exception("Failure sending notification on creation "
                                    "of ticket #%s: %s" % (t.id, e))

-        return t.id
+        return int(t.id)

     def update(self, req, id, comment, attributes = {}, notify=False):
         """ Update a ticket, returning the new ticket in the same form as getTicket(). """

comment:4 in reply to:  3 Changed 17 years ago by chrisky.c@…

The patch works great!

Replying to stp:

Alec, I suspect that the ticket id in the create() method is not converted to an int but has a PostgresSQL specific integer type causing the error. I can't test it since I don't have a working PostgreSQL environment.

Kai, could you try to apply the following patch which adds an explicit type conversion before returning the ticket id to your Trac XML-RPC plug-in:

Index: tracrpc/ticket.py
===================================================================
--- tracrpc/ticket.py   (revision 2617)
+++ tracrpc/ticket.py   (working copy)
@@ -90,7 +90,7 @@
                 self.log.exception("Failure sending notification on creation "
                                    "of ticket #%s: %s" % (t.id, e))

-        return t.id
+        return int(t.id)

     def update(self, req, id, comment, attributes = {}, notify=False):
         """ Update a ticket, returning the new ticket in the same form as getTicket(). """

comment:5 Changed 17 years ago by Alec Thomas

Description: modified (diff)

Is this conversion problem going to occur anywhere else though? It seems that if pyPgSQL is returning something that is almost-an-int here, it may do so elsewhere.

chrisky, is it possible to try one of the other PostgreSQL DBAPI layers, specifically psycopg2, (then remove the patch)? I'd be interested to see if the problem still occurs.

comment:6 Changed 17 years ago by Steffen Pingel

Description: modified (diff)

Yes, I agree that we might run into similar conversion problems for other API calls as well. I wonder if the type conversion should be done in the Trac API before returning tickets and other data.

Kai, have you been able to successfully use other functionality in Mylyn (e.g. queries)?

comment:7 Changed 15 years ago by osimons

Description: modified (diff)
Resolution: wontfix
Status: newclosed

I'm closing this. The way all methods work is that they use Trac codebase to fetch, update and return information. If at any level your db connector returns non-standard Python types (<type 'PgInt8'>) you are going to run into all kinds of other issues with just regular Trac usage. I'd suggest your review trac:wiki:TracInstall and trac:wiki:DatabaseBackend to make sure you are running a supported db connector.

Please reopen if problem persists, and also turn on Trac debug logging and provide relevant information from your logs + 'About Trac' page listing your installed software versions.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.