SchizoDuckie / DuckieTV

A web application built with AngularJS to track your favorite tv-shows with semi-automagic torrent integration
http://schizoduckie.github.io/DuckieTV/
Other
1.13k stars 272 forks source link

Dtv100 upgrade testing problem #416

Closed garfield69 closed 9 years ago

garfield69 commented 9 years ago

I'm trying to test the DuckieTV 1.00 upgrade on chrome browser. I start with a fresh 0.94 and add a couple series. then I overlay the 0.94 directory with the one from 1.00 I'm getting an uncaught (in promise) undefined tab.html:1 ?!? leaves the calendar appearing empty, and no upgrade notices are shown. a check of the library shows the series as expected. After a restart the calendar is populated as expected. Not sure how to track this one down. where is that error really coming from, the CRUD adapter? resources after 0.94 is set up dtv094resources resources after 1.00 is started dtv100resources console log with error dtv100console

garfield69 commented 9 years ago

set CRUD.DEBUG = true; in CRUD.entities.js. log follows:

CRUD.js:13 DB connection to  seriesguide_chrome  opened!
CRUD.js:13 SQLITE connection created to  seriesguide_chrome
CRUD.js:13 verifying that tables exist
CRUD.js:13 execing sql:  select type,name,tbl_name from sqlite_master undefined
DuckieTorrent.js:16 Registering torrent client: tixati
DuckieTorrent.js:16 Registering torrent client: qBittorrent
DuckieTorrent.js:16 Registering torrent client: uTorrent
DuckieTorrent.js:16 Registering torrent client: Transmission
CRUD.js:13 Executing query via sqliteadapter:  Object Object
TorrentMonitor.js:51 Enabling torrent auto-stop!
TorrentSearchEngines.js:24 Registering torrent search engine: KickAssTorrents
TorrentSearchEngines.js:24 Registering torrent search engine: ShowRSS
TorrentSearchEngines.js:24 Registering torrent search engine: Strike
TorrentSearchEngines.js:24 Registering torrent search engine: RarBG
TorrentSearchEngines.js:24 Registering torrent search engine: ThePirateBay
TorrentSearchEngines.js:24 Registering torrent search engine: Torrentz.eu
StorageSyncService.js:26 Register new storage sync target! TraktTVStorageSyncTarget
TraktTVStorageSyncTarget.js:45 TraktTV storage sync target initialized!
CRUD.js:13 Executing query via sqliteadapter:  Object Object
CRUD.js:13 Executing migration:  ALTER TABLE Seasons RENAME TO Seasons_bak
CRUD.js:13 Executing migration:  CREATE TABLE Seasons ( ID_Season INTEGER PRIMARY KEY NOT NULL,ID_Serie INTEGER NOT NULL, poster VARCHAR(255), seasonnumber INTEGER, overview TEXT NULL, ratings INTEGER NULL, ratingcount INTEGER NULL,  UNIQUE (ID_Serie, seasonnumber) ON CONFLICT REPLACE)
CRUD.js:13 Executing migration:  INSERT OR IGNORE INTO Seasons (ID_Season, ID_Serie, poster, seasonnumber) select ID_Season, ID_Serie, poster, seasonnumber from Seasons_bak
CRUD.js:13 Executing migration:  DROP TABLE Seasons_bak
CRUD.js:13 Executing migration:  ALTER TABLE Episodes RENAME TO Episodes_bak
CRUD.js:13 Executing migration:  CREATE TABLE Episodes ( ID_Episode INTEGER PRIMARY KEY NOT NULL,ID_Serie INTEGER NOT NULL, ID_Season INTEGER NULL, TVDB_ID INTEGER UNIQUE, episodename VARCHAR(255), episodenumber INTEGER , seasonnumber INTEGER NULL ,firstaired TIMESTAMP, firstaired_iso varchar(25), IMDB_ID VARCHAR(20), language VARCHAR(3), overview TEXT default NULL, rating INTEGER DEFAULT(NULL), ratingcount INTEGER DEFAULT(NULL), filename VARCHAR(255) , images TEXT, watched INTEGER DEFAULT 0, watchedAt TIMESTAMP NULL,  downloaded INTEGER DEFAULT 0, magnetHash VARCHAR(40) NULL, TRAKT_ID INTEGER NULL )
CRUD.js:13 Executing migration:  INSERT OR IGNORE INTO Episodes (ID_Episode, ID_Serie, ID_Season, TVDB_ID, episodename, episodenumber, seasonnumber, firstaired, IMDB_ID, language, overview, rating, ratingcount, filename, images, watched, watchedAt, downloaded, magnetHash) select ID_Episode, ID_Serie, ID_Season, TVDB_ID, episodename, episodenumber, seasonnumber, firstaired, imdb_id, language, overview, rating, ratingcount, filename, images, coalesce(watched,0), watchedAt, downloaded, magnetHash from Episodes_bak;
CRUD.js:13 Executing migration:  DROP TABLE Episodes_bak
CRUD.js:13 execing sql:  select fanart from Series where fanart != '' undefined
CRUD.js:13 execing sql:  SELECT Series.ID_Serie, 
    Series.name, 
    Series.banner, 
    Series.overview, 
    Series.TVDB_ID, 
    Series.IMDB_ID, 
    Series.TVRage_ID, 
    Series.actors, 
    Series.airs_dayofweek, 
    Series.airs_time, 
    Series.timezone, 
    Series.contentrating, 
    Series.firstaired, 
    Series.genre, 
    Series.country, 
    Series.language, 
    Series.network, 
    Series.rating, 
    Series.ratingcount, 
    Series.runtime, 
    Series.status, 
    Series.added, 
    Series.addedby, 
    Series.fanart, 
    Series.poster, 
    Series.lastupdated, 
    Series.lastfetched, 
    Series.nextupdate, 
    Series.displaycalendar
 FROM 
    Series
  WHERE name is not NULL   LIMIT 0,1000 Array[0]
CRUD.js:13 execing sql:  SELECT Episodes.ID_Episode, 
    Episodes.ID_Serie, 
    Episodes.ID_Season, 
    Episodes.TVDB_ID, 
    Episodes.episodename, 
    Episodes.episodenumber, 
    Episodes.seasonnumber, 
    Episodes.firstaired, 
    Episodes.firstaired_iso, 
    Episodes.IMDB_ID, 
    Episodes.language, 
    Episodes.overview, 
    Episodes.rating, 
    Episodes.ratingcount, 
    Episodes.filename, 
    Episodes.images, 
    Episodes.watched, 
    Episodes.watchedAt, 
    Episodes.downloaded, 
    Episodes.magnetHash, 
    Episodes.TRAKT_ID
 FROM 
    Episodes
  WHERE Episodes.firstaired > "1429963200000" AND Episodes.firstaired < "1433591999999"    LIMIT 0,1000 Array[0]
CRUD.js:13 SQL FAIL!! SQLError SQLTransaction SELECT Episodes.ID_Episode, 
    Episodes.ID_Serie, 
    Episodes.ID_Season, 
    Episodes.TVDB_ID, 
    Episodes.episodename, 
    Episodes.episodenumber, 
    Episodes.seasonnumber, 
    Episodes.firstaired, 
    Episodes.firstaired_iso, 
    Episodes.IMDB_ID, 
    Episodes.language, 
    Episodes.overview, 
    Episodes.rating, 
    Episodes.ratingcount, 
    Episodes.filename, 
    Episodes.images, 
    Episodes.watched, 
    Episodes.watchedAt, 
    Episodes.downloaded, 
    Episodes.magnetHash, 
    Episodes.TRAKT_ID
 FROM 
    Episodes
  WHERE Episodes.firstaired > "1429963200000" AND Episodes.firstaired < "1433591999999"    LIMIT 0,1000 VALUES ()
CRUD.js:13 SQL Error in FIND :  undefined SQLError Object
tab.html:1 Uncaught (in promise) undefined
CRUD.js:13 execing sql:  ALTER TABLE Seasons RENAME TO Seasons_bak undefined
CRUD.js:13 Migration success! CRUD.Database.ResultSet
CRUD.js:13 execing sql:  CREATE TABLE Seasons ( ID_Season INTEGER PRIMARY KEY NOT NULL,ID_Serie INTEGER NOT NULL, poster VARCHAR(255), seasonnumber INTEGER, overview TEXT NULL, ratings INTEGER NULL, ratingcount INTEGER NULL,  UNIQUE (ID_Serie, seasonnumber) ON CONFLICT REPLACE) undefined
CRUD.js:13 Migration success! CRUD.Database.ResultSet
CRUD.js:13 execing sql:  INSERT OR IGNORE INTO Seasons (ID_Season, ID_Serie, poster, seasonnumber) select ID_Season, ID_Serie, poster, seasonnumber from Seasons_bak undefined
CRUD.js:13 Migration success! CRUD.Database.ResultSet
CRUD.js:13 execing sql:  DROP TABLE Seasons_bak undefined
CRUD.js:13 Migration success! CRUD.Database.ResultSet
CRUD.js:13 All migrations executed for version  3
CRUD.js:13 execing sql:  ALTER TABLE Episodes RENAME TO Episodes_bak undefined
CRUD.js:13 Migration success! CRUD.Database.ResultSet
CRUD.js:13 execing sql:  CREATE TABLE Episodes ( ID_Episode INTEGER PRIMARY KEY NOT NULL,ID_Serie INTEGER NOT NULL, ID_Season INTEGER NULL, TVDB_ID INTEGER UNIQUE, episodename VARCHAR(255), episodenumber INTEGER , seasonnumber INTEGER NULL ,firstaired TIMESTAMP, firstaired_iso varchar(25), IMDB_ID VARCHAR(20), language VARCHAR(3), overview TEXT default NULL, rating INTEGER DEFAULT(NULL), ratingcount INTEGER DEFAULT(NULL), filename VARCHAR(255) , images TEXT, watched INTEGER DEFAULT 0, watchedAt TIMESTAMP NULL,  downloaded INTEGER DEFAULT 0, magnetHash VARCHAR(40) NULL, TRAKT_ID INTEGER NULL ) undefined
js/vendor/CRUD.js:13 Migration success! CRUD.Database.ResultSet
js/vendor/CRUD.js:13 execing sql:  INSERT OR IGNORE INTO Episodes (ID_Episode, ID_Serie, ID_Season, TVDB_ID, episodename, episodenumber, seasonnumber, firstaired, IMDB_ID, language, overview, rating, ratingcount, filename, images, watched, watchedAt, downloaded, magnetHash) select ID_Episode, ID_Serie, ID_Season, TVDB_ID, episodename, episodenumber, seasonnumber, firstaired, imdb_id, language, overview, rating, ratingcount, filename, images, coalesce(watched,0), watchedAt, downloaded, magnetHash from Episodes_bak; undefined
js/vendor/CRUD.js:13 Migration success! CRUD.Database.ResultSet
js/vendor/CRUD.js:13 execing sql:  DROP TABLE Episodes_bak undefined
js/vendor/CRUD.js:13 Migration success! CRUD.Database.ResultSet
js/vendor/CRUD.js:13 All migrations executed for version  11
js/vendor/CRUD.js:13 execing sql:  create index if not exists fanart_idx on Series (fanart) undefined
js/vendor/CRUD.js:13 index created:  Series fanart fanart_idx
js/vendor/CRUD.js:13 execing sql:  create index if not exists ID_Serie_idx on Seasons (ID_Serie) undefined
js/vendor/CRUD.js:13 index created:  Seasons ID_Serie ID_Serie_idx
js/vendor/CRUD.js:13 execing sql:  create index if not exists watched_idx on Episodes (watched) undefined
js/vendor/CRUD.js:13 index created:  Episodes watched watched_idx
js/vendor/CRUD.js:13 execing sql:  create index if not exists TVDB_ID_idx on Episodes (TVDB_ID) undefined
js/vendor/CRUD.js:13 index created:  Episodes TVDB_ID TVDB_ID_idx
js/vendor/CRUD.js:13 execing sql:  create index if not exists ID_Seriefirstaired_idx on Episodes (ID_Serie, firstaired) undefined
js/vendor/CRUD.js:13 index created:  Episodes ID_Serie, firstaired ID_Seriefirstaired_idx
js/vendor/CRUD.js:13 execing sql:  create index if not exists ID_Season_idx on Episodes (ID_Season) undefined
js/vendor/CRUD.js:13 index created:  Episodes ID_Season ID_Season_idx
TraktTVUpdateService.js:77 Not performing trakttv update check. already done today.
TraktTVUpdateService.js:85 TraktTV trending update completed. last updated:Thu Jan 01 1970 13:00:00 GMT+1300 (New Zealand Daylight Time)
garfield69 commented 9 years ago

looks like a clash between multi-threads trying to access the DB tables while we are in the middle of performing a CRUD DB rebuild.

SchizoDuckie commented 9 years ago

Looks like episodeairedservice needs to wait a few secs for db access.

garfield69 commented 9 years ago

Ah good. I'll add a timeout to that, while I'm doing the migrationService change for the downloaded=1 update which I'm working on now.

garfield69 commented 9 years ago

No, it does not look like episodeAiredService is the culprit in this instance. The settings has 'torrenting.autodownload': false, so it should not be kicking off. I'll leave the timeout in anyway as this may prevent a future clash with the next migration.

So the only other candidate that uses FavoriteService.getEpisodesForDateRange is the calendarEvents.

How to pause this while a DB reorg is in progress ?

SchizoDuckie commented 9 years ago

Technically it shouldn't even get a handle until all the migrations are done (delayuntilsetupdone in sqliteadapter). Odd. On 13 May 2015 10:03, "garfield69" notifications@github.com wrote:

No, it does not look like episodeAiredService is the culprit in this instance. The settings has 'torrenting.autodownload': false, so it should not be kicking off. I'll leave the timeout in anyway as this may prevent a future clash with the next migration.

So the only other candidate that uses FavoriteService.getEpisodesForDateRange is the calendarEvents.

How to pause this while a DB reorg is in progress ?

— Reply to this email directly or view it on GitHub https://github.com/SchizoDuckie/DuckieTV/issues/416#issuecomment-101562222 .

garfield69 commented 9 years ago

We have run into this issue before, with needing to add timeouts to prevent stuff accessing the DB before the DB reorgs can complete. Perhaps the delayuntilsetupisdone is not working or is not being used in this instance? Anyhow, I think I had better step out of this one, and let you do your thing in peace.