New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: incompatible types, LP_c_short instance instead of LP_c_short instance [PYFB26] #29
Comments
Commented by: nepomnyashiy evgeniy (nepomnyashiy evgeniy) On my environment I often received this error (before I rollback to kinterbasdb). May be I can help you? Write some logs or something else? |
Commented by: @pcisar This is clearly Python/ctypes problem, not FDB problem. The FDB code that occasionally reports this bug is unconditionally called whenever SQL command with data is processed, which means that it should always fail if it would be wrong code. Also, nobody else reports such problem although it should be quite common (code path executed frequently), neither could be reproduced. The error message itself is reported by ctypes (standard Python library module) and illogical (LP_c_short instance instead of LP_c_short instance - i.e. expected type although correctly passed was not recognized). So it's clearly problem in your environment or ctypes itself. I'd suggest to upgrade Python to most recent 2.7 version, preferably from ActiveState (http://www.activestate.com/activepython), and see what happens. |
Commented by: nepomnyashiy evgeniy (nepomnyashiy evgeniy) I use many connection to same db from many threads. With kinterbasdb I set special constant in his init method, but fdb has not this method. I already has last python 2.7 version from http://python.org. I will try to use version from activestate |
Commented by: @pcisar Generally speaking, access from multiple threads shouldn't be a problem, at least if each thread uses it's own Connection object. KDB was written mostly in C that required special handling of multiple threads due to C/Python interface, while FDB is pure Python. And concurrency at FB API level is handled by FB client library. If you're using FB 2.5, there shouldn't be any problem, see http://www.firebirdsql.org/rlsnotesh/rlsnotes25.html#rnfb25-engine-thrdsafe. |
Commented by: Sam Watkins (sswam) We have the same bug today on Ubuntu 14.04.2 LTS 64-bit, using fdb 1.4.9 (built from source), Python 2.7.6, and apache2 mod python with mpm prefork. Again, it only happens when running our app in apache, not in the test web server. An somewhat similar issue with ctypes is reported here, where ctypes reports "incompatible types, X instance instead of X instance": This error can occur if two different POINTER() types have somehow been created with the same name. But looking through the fdb code, I can't see how it would have happened. You don't create POINTER() types using strings as in the other case. I am using "subprocess" to fork and run some other programs. I had thought the error might be related to this, but after testing it seems not. Will let you know if we find a solution. |
Commented by: Sam Watkins (sswam) I hacked around this problem by patching FDB with three ugly casts like this: This hack is very far from ideal but it seems to be preventing the exception. It would be better to fix whatever bug is actually causing us to create two different POINTER(ISC_SHORT) types! |
Submitted by: nepomnyashiy evgeniy (nepomnyashiy evgeniy)
Sometimes I receive strange exception
File "c:\tools\reestr\env\Lib\site-packages\fdb\http://fbcore.py", line 3040, in execute
PreparedStatement(operation, self, True))
File "c:\tools\reestr\env\Lib\site-packages\fdb\http://fbcore.py", line 1701, in __init__
self.__coerce_XSQLDA(self.out_sqlda)
File "c:\tools\reestr\env\Lib\site-packages\fdb\http://fbcore.py", line 2009, in __coerce_XSQLDA
sqlvar.sqlind = ctypes.pointer(ISC_SHORT(0))
TypeError: incompatible types, LP_c_short instance instead of LP_c_short instance
After I receive it first time, every query to database ends with it. Creating new connection or something else dont help - I need to restart apache.
On my development machine (without apache and mod_wsgi) I never receive such exception.
The text was updated successfully, but these errors were encountered: