DuplicatePropertyError: Class class_name already has property property_name - google-app-engine

I'm developing for GAE-Python 2.7 on Mac using Eclipse + PyDev and, since the SDK 1.7.6 (where the new dev_appserver was introduced), I'm having a "DuplicatePropertyError" 4 out of 5 times (on average) when executing the first request. Also, even if the first request goes fine, the error might appear in later requests.
This error is only happening in development (in production everything goes fine) and prior to 1.7.6 I never had this.
I didn't pay too much attention to this problem because, so far, I was using the old_dev_appserver in order to be able to continue debugging my app (Google broke support to pydevd by using stdin/stdout for ipc in the new dev server). However, since the old dev server will be dropped from July 1st, I think it's time to start using the new one :-).
Is anyone else experiencing this problem? Any solution/workaround?
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 515, in __init__
_initialize_properties(cls, name, bases, dct)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 430, in _initialize_properties
attr.__property_config__(model_class, attr_name)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/db/__init__.py", line 3686, in __property_config__
self.collection_name))
DuplicatePropertyError: Class Organization already has property wagesheetrow_set
INFO 2013-06-07 15:13:54,864 server.py:585] default: "GET / HTTP/1.1" 500 -

Just figured it out! Apparently the error is coming when creating a ReferenceProperty without giving it an explicit collection_name.
For example, this might trigger the error:
class WageSheetRow(db.Model):
organization = db.ReferenceProperty(Organization)
and this is the correct way:
class WageSheetRow(db.Model):
organization = db.ReferenceProperty(Organization, collection_name='aName')
This never happened before with the old server but, apparently, the new server (1.7.6+) has changed the way of initialising instances.
It's also to mention that exactly the same code might trigger the error in one specific machine, but not in another one running exactly the same piece of code.

Related

Invalid JWT token happens randomly when using Snowflake+DBT

We've been using Snowflake+DBT with key pair authentication for a long time now, and we've never had any issues.
Recently, we started getting random connection errors on some models:
250001 (08001): Failed to connect to DB: account.region.snowflakecomputing.com:443. JWT token is invalid.
Most of the models will work, but some of them might fail. This can happen to any model, and it's never the same one -- sometimes it's the very first one, sometimes it's the very last one, and sometimes it's a bunch of them. It happens in runs with lots of models, or in runs with a single model.
It's very inconsistent, and there doesn't seems to be any kind of pattern to it. Sometimes it works, and sometimes it doesn't.
We've also tried with 1, 4, or 8 threads, and it happens regardless.
Obviously, there's nothing wrong with the credentials or configurations — otherwise, nothing would run at all. So I assume there must be something wrong with how DBT is handling the connection(s).
Interestingly, the errors only happens locally (so far). We haven't seen it in DBT Cloud runs.
DBT version is 0.20.2 in both cases. We tried with other versions (0.21.0, 0.20.0 & 0.19.1), and the issue persists. I don't know why we're just encountering this, as we've used these other versions previously without any issues.
It's similar to this question, except in our case it doesn't happen consistently at all. We tried connecting "without a region" (using Snowflake Organizations), but it doesn't make any difference:
250001 (08001): Failed to connect to DB: organization-account.snowflakecomputing.com:443. JWT token is invalid.
Is there anything we can do to resolve this?
EDIT: When the error happens, the model hangs for 60 seconds until the error appears.
EDIT 2: I think the error might have started happening when we started using the DBT-provided Docker images. Not sure exactly what might be wrong with them, but we'll try going back to our own custom images and see if that works.
This has since stopped happening. 🤷‍♂️
Possibly because of this change from Snowflake:
"An improvement has been added to Snowflake's Cloud Services layer to relax the validity restrictions."
Also, we are now using different Docker containers, so that might have something to do with it as well:
First, we switched to xemuliam/dbt, from Docker Hub.
But since that is no longer maintained, we are now using the official DBT Docker images from GitHub (which were not available at the time the question was posted):
dbt-core
dbt-postgres
dbt-snowflake

Installation must be finished from the original IP address, sorry - Moodle

I'm trying to install moodle on AWS ec2 and the database is local on ec2 instance and now I'm stuck at error "Installation must be finished from the original IP address, sorry." I have tried all possible solutions on the web but nothing worked for me.
Just comment out these 3 lines and reload:
if ($adminuser->lastip !== getremoteaddr()) {
print_error('installhijacked', 'admin');
}
https://github.com/moodle/moodle/blob/master/admin/index.php#L753-L755
With all due respect, commenting out core Moodle code is not a good idea, especially when there is an easy and safe work around the problem.
When it comes to AWS EC2, commenting out the code may get you past that point in the installation however, the Moodle getremoteaddr() function, which is used everywhere in Moodle, will continue to report an incorrect IP address in things like logs and may even affect the security of your website.
A better approach is to simply add the following line to your Moodle main config.php found in the webroot. It should be placed anywhere between the $CFG = new stdClass(); and require_once(__DIR__ . '/lib/setup.php'); lines:
$CFG->getremoteaddrconf = 0;
This will need to be added anytime up to when you get the error message.
While I have not tried it myself, you may alternatively be able to add the following line to a file called /local/defaults.php (create if it does not already exist):
$defaults['moodle']['getremoteaddrconf'] = 0; // New default for $CFG->getremoteaddrconf.
For more information on defaults.php, see https://docs.moodle.org/dev/Local_plugins#Customised_site_defaults
This defaults.php file can be useful for setting default settings during a new installation if you include it in your Moodle fork.
Hope you find this information helpful.
Best regards,
Michael Milette

OData HTTP400 Timeout Error

This is one of the most bizarre problems I've come across since I started using OData for my mobile apps. The OData server I've developed is backed by SQL Express 2008 and this combination has been installed on 50 different servers and/or PCs over the last 15 months. All 50 servers have been running stable with consistent function for large amounts of data.
A couple of days ago one of my clients contacted me indicating that my client app (running on iOS7) was having an odd error come up when POSTing data to their server. The error had an HTTP code of 400 and the error text is "The operation couldn't be completed. (Timeout error 400.)". My first question is: why is a timeout error coming back with a 400 code? Generally when I get timeouts (due to firewall, etc) they're in the 100x range. There is no indication in the event logs on the server of ANY problems occurring. My own logs (stored in the SQL database) show no error (which is odd because I'm using the generic exception catching method in my OData service to log any problems). I haven't got to the step of adding logging of all requests as yet.
The error is only being raised when posting one particular set of data. All other posts from the device are functioning perfectly. I got the client to re-install the app (deleting all data) and then to download the data set that was causing the error. The download worked fine. We began making changes to the data to replicate what the data looked like when the error occurred in incremental changes, posting the change to the server and observing the result. Most of the incremental changes work fine but certain combinations cause the error to occur. One of the increments involves a large volume of changes and that posts fine, but subsequent alteration of any of the objects (sometimes altering as little as 6 characters in a text field) cause the error to occur. And yet in some circumstances altering objects that have already been posted to the server works without a problem.
I wiped the service components from the server and undertook a fresh install. I shifted TCP ports in case 443 had another listener causing problems. I reset the server. None of these change the behaviour of the error.
My last ditch solution is to completely re-install IIS and .NET Framework but I'd obviously like to avoid this as it's not my server... The server is overseas from my current location so debugging isn't really an option. Hoping someone has an idea as to what I can do diagnostically to try and determine the source of this bizarre 'gremlin'.
Have you tried a more thorough traffic analysis using a tool like Fiddler? The "timeout" error does indeed seem odd and what stood from you post was that your server was "overseas". Could there be something with the "times" that are being used/generated, e.g. server time, local time, etc?
Just to confirm, the "same" exact set of data always fails? Can you replicate this via a remote debugger or via localhost? If so, can you turn on "verbose errors"?

Postgres Database Error: relation does not exist

I am fixing some problems with a legacy system and have run into a snag that I am surprised was not caught sooner. I am running Django 1.3 and using postgres 9.1.3 in running this application. The system is a validation system for users to use the rest of the system. It uses part of the Django users interface, but mostly it has it's own 'Users'.
My problem comes along when I try and give a user their account questions (similar to if you forget a password to a website). When I try to do that it throws this error:
Database Error at admin/password/user
relation "password_user_answered_questions_id_s" does not exist
LINE 1: SELECT CURRVAL('"password_user_quest...
^
Does anyone know what might cause this error? I have tried resetting the db (didn't think it would do anything but just wanted to be sure) and have also poked around in the db using phppgadmin and found that everything else is getting stored correctly except this one. It is using a ManyToMany field when assigning it so that a user can have multiple questions and a question can be used by multiple users.
The reason is most likely that the
relation "password_user_answered_questions_id_s" does not exist
Just like the error message informs us. Are you aware of how PostgreSQL handles identifiers?
Also, sequences are usually named *_seq. Letters missing from the end?
About maximum length of identifiers - I quote the manual from the link above:
The system uses no more than NAMEDATALEN-1 bytes of an identifier;
longer names can be written in commands, but they will be truncated.
By default, NAMEDATALEN is 64 so the maximum identifier length is 63
bytes. If this limit is problematic, it can be raised by changing the
NAMEDATALEN constant in src/include/pg_config_manual.h.
Bold emphasis mine. Seems like you should shorten your identifiers a bit.
The problem is you haven't synced your DB, I guess. Please execute these commands:
python manage.py makemigrations myappname
python manage.py migrate myappname

Sudden error accessing custom settings in SalesForce

We use custom settings in a SalesForce app. We access it like so:
MySettings__c settings = MySettings__c.getOrgDefaults();
This was working fine, but today the app completely crashed. By that I mean the page doesn't load at all, I just get a white screen telling me an internal error occurred. We traced it down to this line of code - when it is commented out the page loads as well as it can without those settings (but at least it loads).
Running that single line of code in the System Log (using the Execute functionality) also causes a report of Internal System Error. The only thing the system log reports is "FATAL_ERROR Internal Salesforce.com Error." The Apex code modal reports "Internal System Error: 1018505045-332 (-920440070)"
The setting has values for the organization - we've also tried deleting the settings and recreating them to no affect. So far SalesForce has been no help beyond telling us to ask on their website.
This is very frustrating as it was working fine on Friday and today it was broken before anyone touched anything.
What you have there is a platform error. Whenever you get those you should report them to SFDC support and they will be able to see further internal logging to sort it out.
Nothing anyone out here can do to help I am afraid.
Paul
try setting the apiVersion of the affected code back to version 21.0. We had the same issue and making this change has provided an effective workaround.
This was a bug in Salesforce's infrastructure, which has been reported resolved. If you're still seeing this error with API version 22.0, you should create a case with salesforce support.

Resources