Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • engine engine
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 26
    • Issues 26
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • AURA
  • engineengine
  • Issues
  • #75

Closed
Open
Created May 05, 2021 by david@davidOwner

Issues with DB Session due to various threads accessing it (MySQL, MariaDB)

This is happening in not clearly predictable scenarios. I've noted it for example from within the TrackService plugin.

2021-05-05 10:40:15,176:AuraEngine:INFO - Posting playlog to Engine API... - [trackservice.py:167-store_trackservice()]
Exception in thread Thread-688:
Traceback (most recent call last):
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1211, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 803, in _init_compiled
    self.cursor = self.create_cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 1159, in create_cursor
    return self._dbapi_connection.cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 1000, in cursor
    return self.connection.cursor(*args, **kwargs)
AttributeError: 'NoneType' object has no attribute 'cursor'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/david/Code/aura/engine/src/events.py", line 253, in func
    self.call_event("on_metadata", data)
  File "/home/david/Code/aura/engine/src/events.py", line 148, in call_event
    method(*args)
  File "/home/david/Code/aura/engine/src/plugins/trackservice.py", line 157, in on_metadata
    self.store_clock_info(data)
  File "/home/david/Code/aura/engine/src/plugins/trackservice.py", line 200, in store_clock_info
    if e.meta_data:
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 287, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 723, in get
    value = self.callable_(state, passive)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 749, in _load_for_state
    return self._emit_lazyload(
  File "<string>", line 1, in <lambda>
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 890, in _emit_lazyload
    q(session)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/ext/baked.py", line 545, in all
    return list(self)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/ext/baked.py", line 445, in __iter__
    return q._execute_and_instances(context)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3506, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1020, in execute
    return meth(self, multiparams, params)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1133, in _execute_clauseelement
    ret = self._execute_context(
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1213, in _execute_context
    self._handle_dbapi_exception(
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1517, in _handle_dbapi_exception
    util.raise_(
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1211, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 803, in _init_compiled
    self.cursor = self.create_cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 1159, in create_cursor
    return self._dbapi_connection.cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 1000, in cursor
    return self.connection.cursor(*args, **kwargs)
sqlalchemy.exc.StatementError: (builtins.AttributeError) 'NoneType' object has no attribute 'cursor'
[SQL: SELECT playlist_entry_metadata.artificial_id AS playlist_entry_metadata_artificial_id, playlist_entry_metadata.artificial_entry_id AS playlist_entry_metadata_artificial_entry_id, playlist_entry_metadata.artist AS playlist_entry_metadata_artist, playlist_entry_metadata.title AS playlist_entry_metadata_title, playlist_entry_metadata.album AS playlist_entry_metadata_album 
FROM playlist_entry_metadata 
WHERE %s = playlist_entry_metadata.artificial_entry_id]
[parameters: [{'%(140296918919056 param)s': 354}]]
2021-05-05 10:40:15,669:AuraEngine:INFO - [ECI] Event 'on_metadata' issued successfully - [control.py:164-process()]
2021-05-05 10:40:15,670:AuraEngine:INFO - Found no entry in the recent history which matches the given source '../audio/station2/01 Journey in Satchidananda.mp3' - [trackservice.py:420-resolve_entry()]
2021-05-05 10:40:15,670:AuraEngine:INFO - Posting playlog to Engine API... - [trackservice.py:167-store_trackservice()]
Exception in thread Thread-689:
Traceback (most recent call last):
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1211, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 803, in _init_compiled
    self.cursor = self.create_cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 1159, in create_cursor
    return self._dbapi_connection.cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 1000, in cursor
    return self.connection.cursor(*args, **kwargs)
AttributeError: 'NoneType' object has no attribute 'cursor'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/david/Code/aura/engine/src/events.py", line 253, in func
    self.call_event("on_metadata", data)
  File "/home/david/Code/aura/engine/src/events.py", line 148, in call_event
    method(*args)
  File "/home/david/Code/aura/engine/src/plugins/trackservice.py", line 157, in on_metadata
    self.store_clock_info(data)
  File "/home/david/Code/aura/engine/src/plugins/trackservice.py", line 200, in store_clock_info
    if e.meta_data:
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 287, in __get__
    return self.impl.get(instance_state(instance), dict_)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/attributes.py", line 723, in get
    value = self.callable_(state, passive)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 749, in _load_for_state
    return self._emit_lazyload(
  File "<string>", line 1, in <lambda>
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/strategies.py", line 890, in _emit_lazyload
    q(session)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/ext/baked.py", line 545, in all
    return list(self)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/ext/baked.py", line 445, in __iter__
    return q._execute_and_instances(context)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3506, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1020, in execute
    return meth(self, multiparams, params)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1133, in _execute_clauseelement
    ret = self._execute_context(
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1213, in _execute_context
    self._handle_dbapi_exception(
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1517, in _handle_dbapi_exception
    util.raise_(
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 178, in raise_
    raise exception
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1211, in _execute_context
    context = constructor(dialect, self, conn, *args)
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 803, in _init_compiled
    self.cursor = self.create_cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 1159, in create_cursor
    return self._dbapi_connection.cursor()
  File "/home/david/Code/aura/engine/python/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 1000, in cursor
    return self.connection.cursor(*args, **kwargs)
sqlalchemy.exc.StatementError: (builtins.AttributeError) 'NoneType' object has no attribute 'cursor'
[SQL: SELECT playlist_entry_metadata.artificial_id AS playlist_entry_metadata_artificial_id, playlist_entry_metadata.artificial_entry_id AS playlist_entry_metadata_artificial_entry_id, playlist_entry_metadata.artist AS playlist_entry_metadata_artist, playlist_entry_metadata.title AS playlist_entry_metadata_title, playlist_entry_metadata.album AS playlist_entry_metadata_album 
FROM playlist_entry_metadata 
WHERE %s = playlist_entry_metadata.artificial_entry_id]
[parameters: [{'%(140296918919056 param)s': 354}]]

After that the DB connection appears to generally broken, making it impossible to fetch further timeslots for example.

 Unhandled error while fetching & scheduling new programme! ((builtins.AttributeError) 'NoneType' object has no attribute 'cursor'
[SQL: SELECT timeslot.id AS timeslot_id_1, timeslot.playlist_id AS timeslot_playlist_id, timeslot.default_schedule_playlist_id AS timeslot_default_schedule_playlist_id, timeslot.default_show_playlist_id AS timeslot_default_show_playlist_id, timeslot.schedule_fallback_id AS timeslot_schedule_fallback_id, timeslot.show_fallback_id AS timeslot_show_fallback_id, timeslot.station_fallback_id AS timeslot_station_fallback_id, timeslot.timeslot_start AS timeslot_timeslot_start, timeslot.timeslot_end AS timeslot_timeslot_end, timeslot.timeslot_id AS timeslot_timeslot_id, timeslot.show_id AS timeslot_show_id, timeslot.show_name AS timeslot_show_name, timeslot.show_hosts AS timeslot_show_hosts, timeslot.funding_category AS timeslot_funding_category, timeslot.comment AS timeslot_comment, timeslot.languages AS timeslot_languages, timeslot.type AS timeslot_type, timeslot.category AS timeslot_category, timeslot.topic AS timeslot_topic, timeslot.musicfocus AS timeslot_musicfocus, timeslot.is_repetition AS timeslot_is_repetition 
FROM timeslot 
WHERE timeslot.timeslot_start >= (builtins.AttributeError) 'NoneType' object has no attribute 'cursor'
[SQL: SELECT timeslot.id AS timeslot_id_1, timeslot.playlist_id AS timeslot_playlist_id, timeslot.default_schedule_playlist_id AS timeslot_default_schedule_playlist_id, timeslot.default_show_playlist_id AS timeslot_default_show_playlist_id, timeslot.schedule_fallback_id AS timeslot_schedule_fallback_id, timeslot.show_fallback_id AS timeslot_show_fallback_id, timeslot.station_fallback_id AS timeslot_station_fallback_id, timeslot.timeslot_start AS timeslot_timeslot_start, timeslot.timeslot_end AS timeslot_timeslot_end, timeslot.timeslot_id AS timeslot_timeslot_id, timeslot.show_id AS timeslot_show_id, timeslot.show_name AS timeslot_show_name, timeslot.show_hosts AS timeslot_show_hosts, timeslot.funding_category AS timeslot_funding_category, timeslot.comment AS timeslot_comment, timeslot.languages AS timeslot_languages, timeslot.type AS timeslot_type, timeslot.category AS timeslot_category, timeslot.topic AS timeslot_topic, timeslot.musicfocus AS timeslot_musicfocus, timeslot.is_repetition AS timeslot_is_repetition 
FROM timeslot 
WHERE timeslot.timeslot_start >= %s ORDER BY timeslot.timeslot_start]
[parameters: [immutabledict({})]] ORDER BY timeslot.timeslot_start]
[parameters: [immutabledict({})]]) 
Edited Jul 10, 2021 by david
Assignee
Assign to
Time tracking