buildbot / sandbox

ticket migration sandbox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitPoller crashes when the repository has too many branches (MySQL Truncates JSON).

bb-bot opened this issue · comments

This ticket is a migrated Trac ticket 3593

People contributed to the original ticket: @djmitche (commenter), @rayene (commenter, reporter)


GitPoller stores a json value in the object_state MySQL table.
The type of value_json field is TEXT. TEXT is limited to 65,535 bytes.

When many branches with long names exist in the git repo, the json string generated by [[GitPoller]] can be larger than 65,535 bytes. MySQL truncates the string.

When [[GitPoller]] tries to read back the value, it does not find a well-formed json string.

Exception :

2016-08-05 18:33:49+0000 [-] Got fatal Exception on DB
	Traceback (most recent call last):
	Failure: exceptions.[[TypeError]]: JSON error loading state value 'lastRev' for 2
	
2016-08-05 18:33:49+0000 [-] Starting factory <twisted.web.client._HTT[[P11ClientFactory]] instance at 0x7f5bbd3f2cb0>
2016-08-05 18:33:49+0000 [-] while initializing [[GitPoller]] repository
	Traceback (most recent call last):
	  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 434, in errback
	    self._start[[RunCallbacks]](fail)
	  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 501, in _start[[RunCallbacks]]
	    self._runCallbacks()
	  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 588, in _runCallbacks
	    current.result = callback(current.result, *args, **kw)
	  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1184, in gotResult
	    _inlineCallbacks(r, g, deferred)
	--- <exception caught here> ---
	  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1126, in _inlineCallbacks
	    result = result.throw[[ExceptionIntoGenerator]](g)
	  File "/usr/local/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throw[[ExceptionIntoGenerator]]
	    return g.throw(self.type, self.value, self.tb)
	  File "/usr/local/lib/python2.7/dist-packages/buildbot/util/state.py", line 31, in getState
	    **kwargs)
	  File "/usr/local/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 246, in inContext
	    result = inContext.theWork()
	  File "/usr/local/lib/python2.7/dist-packages/twisted/python/threadpool.py", line 262, in <lambda>
	    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
	  File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 118, in call[[WithContext]]
	    return self.currentContext().call[[WithContext]](ctx, func, *args, **kw)
	  File "/usr/local/lib/python2.7/dist-packages/twisted/python/context.py", line 81, in call[[WithContext]]
	    return func(*args,**kw)
	  File "/usr/local/lib/python2.7/dist-packages/buildbot/db/pool.py", line 175, in __thd
	    rv = callable(arg, *args, **kwargs)
	  File "/usr/local/lib/python2.7/dist-packages/buildbot/db/state.py", line 93, in thd
	    return self.thd[[GetState]](conn, objectid, name, default=default)
	  File "/usr/local/lib/python2.7/dist-packages/buildbot/db/state.py", line 115, in thd[[GetState]]
	    (name, objectid))
	exceptions.[[TypeError]]: JSON error loading state value 'lastRev' for 2