#14 AssertionError when ISP try to change it's shortname

Closed
opened 8 years ago by sebian · 10 comments
sebian commented 8 years ago
2017-03-15 18:00:11.200296: Attempting to update <ISP u'FMA'>
    last successful update=2015-11-12 11:00:04.083865+01:00
    last update attempt=2015-11-13 14:00:03.556809+01:00
    next update was scheduled 487 days, 16:00:06.848470 ago
    strike=0
Traceback (most recent call last):
  File "ffdnispdb/cron_task.py", line 151, in <module>
    db.session.commit()
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 149, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 721, in commit
    self.transaction.commit()
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 354, in commit
    self._prepare_impl()
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 323, in _prepare_impl
    self.session.dispatch.before_commit(self.session)
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/event.py", line 372, in __call__
    fn(*args, **kw)
  File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 207, in pre_save_hook
    v.pre_save(sess)
  File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 97, in pre_save
    assert self.shortname == self.json['shortname']
AssertionError
❯ curl -s https://moncoin.faimaison.net/isp.json |jq . 
{
  "subscriberCount": 79,
  "website": "https://www.faimaison.net/",
  "name": "FAImaison",
  "otherWebsites": {
    "Wiki": "https://wiki.faimaison.net/",
    "Gitlab": "https://git.faimaison.net/"
  },
  "memberCount": 109,
  "progressStatus": 7,
  "chatrooms": [
    "irc://irc.geeknode.org/#faimaison"
  ],
  "registeredOffice": {
    "region": "Loire Atlantique",
    "street-address": "7 rue Maurice Sibille",
    "postal-code": "44000",
    "country-name": "France",
    "locality": "Nantes"
  },
  "coordinates": {
    "latitude": 47.2169,
    "longitude": -1.5549
  },
  "mainMailingList": "info@faimaison.net",
  "coveredAreas": [
    {
      "technologies": [
        "wifi"
      ],
      "name": "Accès internet haut débit sans-fil"
    },
    {
      "technologies": [
        "dsl"
      ],
      "name": "ADSL marque blanche FDN"
    },
    {
      "technologies": [
        "dsl"
      ],
      "name": "VPN"
    },
    {
      "technologies": [
        "cube"
      ],
      "name": "Nantes et environs"
    }
  ],
  "version": 0.1,
  "ffdnMemberSince": "2012-06-04",
  "logoURL": "https://www.faimaison.net/theme/images/logo.png",
  "shortname": "FAImaison",
  "creationDate": "2011-01-19",
  "email": "contact@faimaison.net",
  "description": "FAImaison est un fournisseur d'accès à internet offrant un service sur Nantes et ses alentours"
}
``` 2017-03-15 18:00:11.200296: Attempting to update <ISP u'FMA'> last successful update=2015-11-12 11:00:04.083865+01:00 last update attempt=2015-11-13 14:00:03.556809+01:00 next update was scheduled 487 days, 16:00:06.848470 ago strike=0 Traceback (most recent call last): File "ffdnispdb/cron_task.py", line 151, in <module> db.session.commit() File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 149, in do return getattr(self.registry(), name)(*args, **kwargs) File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 721, in commit self.transaction.commit() File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 354, in commit self._prepare_impl() File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 323, in _prepare_impl self.session.dispatch.before_commit(self.session) File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/event.py", line 372, in __call__ fn(*args, **kw) File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 207, in pre_save_hook v.pre_save(sess) File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 97, in pre_save assert self.shortname == self.json['shortname'] AssertionError ``` ``` ❯ curl -s https://moncoin.faimaison.net/isp.json |jq . { "subscriberCount": 79, "website": "https://www.faimaison.net/", "name": "FAImaison", "otherWebsites": { "Wiki": "https://wiki.faimaison.net/", "Gitlab": "https://git.faimaison.net/" }, "memberCount": 109, "progressStatus": 7, "chatrooms": [ "irc://irc.geeknode.org/#faimaison" ], "registeredOffice": { "region": "Loire Atlantique", "street-address": "7 rue Maurice Sibille", "postal-code": "44000", "country-name": "France", "locality": "Nantes" }, "coordinates": { "latitude": 47.2169, "longitude": -1.5549 }, "mainMailingList": "info@faimaison.net", "coveredAreas": [ { "technologies": [ "wifi" ], "name": "Accès internet haut débit sans-fil" }, { "technologies": [ "dsl" ], "name": "ADSL marque blanche FDN" }, { "technologies": [ "dsl" ], "name": "VPN" }, { "technologies": [ "cube" ], "name": "Nantes et environs" } ], "version": 0.1, "ffdnMemberSince": "2012-06-04", "logoURL": "https://www.faimaison.net/theme/images/logo.png", "shortname": "FAImaison", "creationDate": "2011-01-19", "email": "contact@faimaison.net", "description": "FAImaison est un fournisseur d'accès à internet offrant un service sur Nantes et ses alentours" } ```
taziden commented 8 years ago
Owner

This is fixed for FMA and Rhizome manually by updating the sqlite database directly :

update isp set shortname = "FAImaison" where id == 50;

This is fixed for FMA and Rhizome manually by updating the sqlite database directly : `update isp set shortname = "FAImaison" where id == 50;`
opi commented 8 years ago
Owner

Some IRC logs, in french:


(10:16:18) taziden: du coup, je suis d'avis de changer ce bout de code dans db
(10:16:20) taziden: ffdnispdb/models.py:        if 'shortname' in self.json:
(10:16:22) taziden: ffdnispdb/models.py:            assert self.shortname == self.json['shortname']
(10:16:45) taziden: pour faire en sorte que si self.shortname diffère de self.json['shortname'], la valeur de self.shortname devient self.json['shortname']
(10:17:05) taziden: problem solved

seems a good idea.

Some IRC logs, in french: ``` (10:16:18) taziden: du coup, je suis d'avis de changer ce bout de code dans db (10:16:20) taziden: ffdnispdb/models.py: if 'shortname' in self.json: (10:16:22) taziden: ffdnispdb/models.py: assert self.shortname == self.json['shortname'] (10:16:45) taziden: pour faire en sorte que si self.shortname diffère de self.json['shortname'], la valeur de self.shortname devient self.json['shortname'] (10:17:05) taziden: problem solved ``` seems a good idea.
opi commented 8 years ago
Owner

Does this assertions really needed ? https://code.ffdn.org/FFDN/ffdn-db/src/master/ffdnispdb/models.py#L93-L97

( added by ff406e3c72 "Sanity check in the ISP model" )

Does this assertions really needed ? https://code.ffdn.org/FFDN/ffdn-db/src/master/ffdnispdb/models.py#L93-L97 ( added by ff406e3c720656bf659e53674b9c7230ad60c21a "Sanity check in the ISP model" )
sebian commented 8 years ago
Owner

@taziden, you're change doesn't fix the issue, please see cron.log file.

2017-03-20 11:20:02.966251: Attempting to update <ISP u'FAImaison'>
    last successful update=2015-11-12 11:00:04.083865+01:00
    last update attempt=2017-03-15 21:00:05.436072+01:00
    next update was scheduled 492 days, 9:19:58.620715 ago
    strike=0
Traceback (most recent call last):
  File "ffdnispdb/cron_task.py", line 113, in <module>
    db.session.commit()
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 149, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 721, in commit
    self.transaction.commit()
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 354, in commit
    self._prepare_impl()
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 323, in _prepare_impl
    self.session.dispatch.before_commit(self.session)
  File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/event.py", line 372, in __call__
    fn(*args, **kw)
  File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 207, in pre_save_hook
    v.pre_save(sess)
  File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 97, in pre_save
    assert self.shortname == self.json['shortname']
AssertionError
@taziden, you're change doesn't fix the issue, please see `cron.log` file. ``` 2017-03-20 11:20:02.966251: Attempting to update <ISP u'FAImaison'> last successful update=2015-11-12 11:00:04.083865+01:00 last update attempt=2017-03-15 21:00:05.436072+01:00 next update was scheduled 492 days, 9:19:58.620715 ago strike=0 Traceback (most recent call last): File "ffdnispdb/cron_task.py", line 113, in <module> db.session.commit() File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 149, in do return getattr(self.registry(), name)(*args, **kwargs) File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 721, in commit self.transaction.commit() File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 354, in commit self._prepare_impl() File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 323, in _prepare_impl self.session.dispatch.before_commit(self.session) File "/srv/www/ffdn.org/db/env/local/lib/python2.7/site-packages/sqlalchemy/event.py", line 372, in __call__ fn(*args, **kw) File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 207, in pre_save_hook v.pre_save(sess) File "/srv/www/ffdn.org/db/ffdn-db/ffdnispdb/models.py", line 97, in pre_save assert self.shortname == self.json['shortname'] AssertionError ```
taziden commented 8 years ago
Owner

crying internally

*crying internally*
sebian commented 8 years ago
Owner

ok for the assertion on the name, but indeed for the shortname, I don't know… :-/

ok for the assertion on the name, but indeed for the shortname, I don't know… :-/
opi commented 8 years ago
Owner

@taziden : https://db.ffdn.org/isp/50/ shortname is still "FMA", despite your database manual update.

@taziden : https://db.ffdn.org/isp/50/ shortname is still "FMA", despite your database manual update.
taziden commented 8 years ago
Owner
sqlite> select name, shortname from isp where id= 50;
FAImaison|FAImaison
``` sqlite> select name, shortname from isp where id= 50; FAImaison|FAImaison ```
opi commented 8 years ago
Owner

Damn. Some caching issue somewhere ?

Damn. Some caching issue somewhere ?
adrien commented 7 years ago

Is an ISP update able to block other updates because it raises an exception and the whole process aborts? If so, shouldn't each update be wrapped in a catch-all block?

Is an ISP update able to block other updates because it raises an exception and the whole process aborts? If so, shouldn't each update be wrapped in a catch-all block?
Sign in to join this conversation.
No Label
bug
No Milestone
No assignee
4 Participants
Loading...
Cancel
Save
There is no content yet.