Calibre content server crashes

Bug #1426171 reported by Andrew Myers
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
Confirmed
Low
Unassigned
calibre (Ubuntu)
Confirmed
Low
Unassigned
Nominated for Utopic by Alberto Salvia Novella

Bug Description

I started the calibre content server from preferences on port 9090 with a custom username and password. When
I try to access it, either from a web browser via the test server option or using Calibre Companion I get a 500 server error.
There is this traceback in the calibre logs:

[26/Feb/2015:17:12:33] HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 364, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 57, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 68, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 111, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)

[26/Feb/2015:17:12:54] HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 670, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 217, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 61, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 364, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 57, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/dist-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 68, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/dist-packages/cherrypy/_cpcompat.py", line 111, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)

ProblemType: Bug
DistroRelease: Ubuntu 14.10
Package: calibre 2.5.0+dfsg-1
ProcVersionSignature: Ubuntu 3.16.0-24.32-generic 3.16.4
Uname: Linux 3.16.0-24-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.14.7-0ubuntu8.2
Architecture: amd64
CurrentDesktop: Unity
Date: Thu Feb 26 19:00:30 2015
InstallationDate: Installed on 2014-11-20 (98 days ago)
InstallationMedia: Ubuntu 14.10 "Utopic Unicorn" - Release amd64 (20141022.1)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=en_US
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/zsh
SourcePackage: calibre
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Andrew Myers (asm198) wrote :
Revision history for this message
brjhaverkamp (bert-bertenselena) wrote :

I can confirm this bug.

I found some background info.
It is refered to and explained here

https://bitbucket.org/cherrypy/cherrypy/issue/1285/n-must-be-a-native-str-got-unicode

Revision history for this message
danfreedom23 (danfreedom23) wrote :

Yes, I Just tried to set-up Calibre Companion to log-in to the Ubuntu version of the Calibre Content Server…
Calibre does indeed crash straight away when I try to start the server.
The wireless device connection seems to start ok, but both are needed!
This is a pretty important bug to fix!

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in calibre (Ubuntu):
status: New → Confirmed
Changed in calibre (Ubuntu):
importance: Undecided → Medium
importance: Medium → Low
Changed in calibre:
status: New → Confirmed
Changed in hundredpapercuts:
status: New → Confirmed
importance: Undecided → Low
Kovid Goyal (kovid)
no longer affects: calibre
Revision history for this message
danfreedom23 (danfreedom23) wrote :

I have had a chance to experiment more with this…

–if the server port is already in use, Calibre will crash! (so double check that!)
–If you create a User Name and Password & try to log-in, you will receive '500 Internal Server Error' (tested on Chrome using a windows and Linux machine; Content Server running on Ubuntu, Calibre 2.5)
–If you create a User Name WITHOUT a Password, you can successfully log-in! (but obviously a password would be preferable!)

Revision history for this message
Eli Schwartz (eschwartz) wrote :

calibre bundles a modified version of cherrypy that fixes this bug. Try running the recommended calibre binary install from the website. ;)

Ubuntu could fix this problem if it can get calibre's cherrypy changes upstreamed.

Obviously, that won't fix the problem of Ubuntu shipping ancient versions of calibre, but I suppose that isn't a Ubuntu priority.

Aside: See the calibre manual for reverse-proxying calibre-server behind apache: http://manual.calibre-ebook.com/server.html
Then use apache's auth setup, which is much better e.g. HTTPS

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.