-
-
Notifications
You must be signed in to change notification settings - Fork 311
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
fix: Fixed _pickle.UnpicklingError #576
Conversation
Error Details The migration process attempted to apply the migration 0003_drop_pickle but failed with the following traceback: ```bash Operations to perform: Target specific migration: 0003_drop_pickle, from constance Running migrations: Applying constance.0003_drop_pickle...Traceback (most recent call last): File "/code/manage.py", line 23, in <module> main() File "/code/manage.py", line 19, in main execute_from_command_line(sys.argv) File "/code/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/code/.venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/code/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv self.execute(*args, **cmd_options) File "/code/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/code/.venv/lib/python3.12/site-packages/django/core/management/base.py", line 107, in wrapper res = handle_func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/code/.venv/lib/python3.12/site-packages/django/core/management/commands/migrate.py", line 357, in handle post_migrate_state = executor.migrate( ^^^^^^^^^^^^^^^^^ File "/code/.venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 135, in migrate state = self._migrate_all_forwards( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/code/.venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 167, in _migrate_all_forwards state = self.apply_migration( ^^^^^^^^^^^^^^^^^^^^^ File "/code/.venv/lib/python3.12/site-packages/django/db/migrations/executor.py", line 255, in apply_migration state = migration.apply(state, schema_editor) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/code/.venv/lib/python3.12/site-packages/django/db/migrations/migration.py", line 132, in apply operation.database_forwards( File "/code/.venv/lib/python3.12/site-packages/django/db/migrations/operations/special.py", line 196, in database_forwards self.code(from_state.apps, schema_editor) File "/code/.venv/lib/python3.12/site-packages/constance/migrations/0003_drop_pickle.py", line 43, in migrate_pickled_data print(pickle.loads(value)) ^^^^^^^^^^^^^^^^^^^ _pickle.UnpicklingError: invalid load key, '{'. ``` The error indicates that there is an issue with unpickling data during the migration process. Specifically, it raises an `_pickle.UnpicklingError` with the message "invalid load key, '{'." This suggests that the data being loaded may be corrupted or not in the expected format.
Not sure that this is a right fix of the problem. This fix only ignores the problem. @camilonova please let a chance for review before merging |
@felipe3dfx what value is stored in the problem key? I guess some collection list or dict? |
This isn't a fix but a careless suppress of an underlying error. Chances are high that this can lead to much more serious troubles - users got exceptions much more later, when there's no clear context of the migration issues. It would be better to understand the problem. The exception here seems like some kind of re-applying the migration, as picle.loads(b'{"__key__": "default", "__value__": 1}')
...
_pickle.UnpicklingError: invalid load key, '{'. Was it a second attempt of the migration? If so, what was a first error? |
Can this be released please? The issue happens when |
@Mogost The value that raised the issue was: |
This fix should not be released in this form. I fully support @ivan-klass's
|
@hvdklauw thank you for the context. Not sure where redis get the value of new format, but if there's a rush on this, I would still recommend to limit the suppress to that case of re-applying the conversion |
Working on the PR right now |
Error Details
The migration process attempted to apply the migration 0003_drop_pickle but failed with the following traceback: