Web-client corrupts binary fields (e.g. company logo)

Bug #670228 reported by Arshad
88
This bug affects 14 people
Affects Status Importance Assigned to Milestone
Odoo Web Client
Fix Released
High
OpenERP R&D Web Team

Bug Description

When we try to generate an accounting report from the web client. ( 6.0 RC1 )

For example.

The General Ledger report from Accounting division
 ( Reporting -> Legal Reports -> Accounting Reports -> General Ledger )

It crashes with the message - (<class 'binascii.Error'>, Error('Incorrect padding',), <traceback object at 0x4b1f200>)

We are using 64 bit Ubuntu 10.04 LTS. This seems to work fine when running on a 32 bit Ubuntu 10.04 LTS.

After a bit of googling we found that the issue maybe with Python libraries (?) that you are using.

The source code we are using is the same that is published on the OpenERP website ( 6.0 RC1 )

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Hello,
We need more information: did you used a logo in the company ? is this with demo data or others data ?

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Arshad (arshad-hisham) wrote : Re: [Bug 670228] Re: Report generation crashes on web-client (64 Bit OS)
Download full text (4.5 KiB)

Hello,

   Thank you for the response.

   This is with a fresh install of OpenERP 6.0 RC1 web client with no
modifications and with no customisations.

   i.e with demo data.

  As I again repeated earlier - the installation is on Ubuntu 10.04 LTS 64
bit.

  I tried connecting to the 64 bit server through an openerp 6.0 client
installed on another 32 bit linux machine.

  The same error was repeated when tyring to print an accounting report.

  So may be it is a problem with the openerp 6.0 server running on the 64
bit LTS ubuntu?

  I am pasting the traceback here

  administrator@ubuntu:~/openerp-client-6.0.0-rc1/bin$
/home/administrator/openerp-client-6.0.0-rc1/bin/modules/gui/window/tree.py:140:
GtkWarning: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
  rb.set_icon_widget(hb)
/home/administrator/openerp-client-6.0.0-rc1/bin/modules/gui/window/tree.py:145:
GtkWarning: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
  wid.insert(rb, -1)
Traceback (most recent call last):
  File
"/home/administrator/openerp-client-6.0.0-rc1/bin/widget/view/form_gtk/parser.py",
line 121, in button_clicked
    model.get_button_action(self.form.screen, id, self.attrs)
  File
"/home/administrator/openerp-client-6.0.0-rc1/bin/widget/model/record.py",
line 375, in get_button_action
    obj._exec_action(result, {}, context=context)
  File
"/home/administrator/openerp-client-6.0.0-rc1/bin/modules/action/main.py",
line 171, in _exec_action
    self.exec_report(action['report_name'], datas, context)
  File
"/home/administrator/openerp-client-6.0.0-rc1/bin/modules/action/main.py",
line 58, in exec_report
    val = rpc.session.rpc_exec_auth('/report', 'report_get', report_id)
  File "/home/administrator/openerp-client-6.0.0-rc1/bin/rpc.py", line 185,
in rpc_exec_auth
    return sock.exec_auth(method, *args)
  File "/home/administrator/openerp-client-6.0.0-rc1/bin/rpc.py", line 119,
in exec_auth
    res = self.execute(method, self._uid, self._passwd, *args)
  File "/home/administrator/openerp-client-6.0.0-rc1/bin/rpc.py", line 136,
in execute
    raise e
tiny_socket.Myexception: ("warning -- Incorrect padding\n\n(<class
'binascii.Error'>, Error('Incorrect padding',), <traceback object at
0x487eab8>)", 'Traceback (most recent call last):\n File
"/usr/local/lib/python2.6/dist-packages/openerp-server/netsvc.py", line 489,
in dispatch\n result =
ExportService.getService(service_name).dispatch(method, auth, params)\n
 File
"/usr/local/lib/python2.6/dist-packages/openerp-server/service/web_services.py",
line 685, in dispatch\n res = fn(db, uid, *params)\n File
"/usr/local/lib/python2.6/dist-packages/openerp-server/service/web_services.py",
line 763, in exp_report_get\n return self._check_report(report_id)\n
 File
"/usr/local/lib/python2.6/dist-packages/openerp-server/service/web_services.py",
line 741, in _check_report\n self.abortResponse(exc, exc.message,
\'warning\', exc.traceback)\n File
"/usr/local/lib/python2.6/dist-packages/openerp-server/netsvc.py", line 129,
in abortResponse\n raise Exception("%s -- %s\\n\\n%s"%(origin,
description, details))\nException: warning -- Incorrect padding\n\n(<class
\'binascii.Error\'>, Erro...

Read more...

Revision history for this message
Arshad (arshad-hisham) wrote :
Download full text (6.7 KiB)

Hello,

  Aplologies for not attaching this earlier.

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[01]: Exception:
Incorrect padding

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[02]: Traceback (most
recent call last):

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[03]: File
"/usr/local/lib/python2.6/dist-packages/openerp-server/service/web_services.py",
line 711, in go

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[04]: (result,
format) = obj.create(cr, uid, ids, datas, context)

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[05]: File
"/usr/local/lib/python2.6/dist-packages/openerp-server/report/report_sxw.py",
line 399, in create

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[06]: fnct_ret =
fnct(cr, uid, ids, data, report_xml, context)

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[07]: File
"/usr/local/lib/python2.6/dist-packages/openerp-server/report/report_sxw.py",
line 462, in create_source_pdf

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[08]: return
self.create_single_pdf(cr, uid, ids, data, report_xml, context)

[2010-11-03 08:39:39,703][openerp] ERROR:web-services:[09]: File
"/usr/local/lib/python2.6/dist-packages/openerp-server/report/report_sxw.py",
line 482, in create_single_pdf

[2010-11-03 08:39:39,704][openerp] ERROR:web-services:[10]: logo =
base64.decodestring(rml_parser.logo)

[2010-11-03 08:39:39,704][openerp] ERROR:web-services:[11]: File
"/usr/lib/python2.6/base64.py", line 321, in decodestring

[2010-11-03 08:39:39,704][openerp] ERROR:web-services:[12]: return
binascii.a2b_base64(s)

[2010-11-03 08:39:39,704][openerp] ERROR:web-services:[13]: Error: Incorrect
padding

[03/Nov/2010:08:39:40] HTTP Traceback (most recent call last):

Looks like the yellow one is the culprit.

There are other problems reported by other python programmers on the net
with base64.py,

   hence I asked whether those were at fault (?)

Best regards,

Arshad

On Wed, Nov 3, 2010 at 1:55 PM, Arshad Hisham A.P.M <<email address hidden>
> wrote:

> Hello,
>
> Thank you for the response.
>
> This is with a fresh install of OpenERP 6.0 RC1 web client with no
> modifications and with no customisations.
>
> i.e with demo data.
>
> As I again repeated earlier - the installation is on Ubuntu 10.04 LTS 64
> bit.
>
> I tried connecting to the 64 bit server through an openerp 6.0 client
> installed on another 32 bit linux machine.
>
> The same error was repeated when tyring to print an accounting report.
>
> So may be it is a problem with the openerp 6.0 server running on the 64
> bit LTS ubuntu?
>
> I am pasting the traceback here
>
> administrator@ubuntu:~/openerp-client-6.0.0-rc1/bin$
> /home/administrator/openerp-client-6.0.0-rc1/bin/modules/gui/window/tree.py:140:
> GtkWarning: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
> rb.set_icon_widget(hb)
> /home/administrator/openerp-client-6.0.0-rc1/bin/modules/gui/window/tree.py:145:
> GtkWarning: gtk_misc_set_alignment: assertion `GTK_IS_MISC (misc)' failed
> wid.insert(rb, -1)
> Traceback (most recent call last):
> File
> "/home/administrator/openerp-cl...

Read more...

Revision history for this message
Christian Sprauer (csprauer) wrote : Re: Report generation crashes on web-client (64 Bit OS)

Hello,

I also have this bug in the web client, when trying to generate of purchase order report.

It happened on a fresh install of OpenERP 6.0 RC1 with no demo data.

The company used a logo and no header & footer. The first time the pdf could be generated but the formatting was weard . The logo was taken on top properly.

Then I modified the company header & footer and then the bug appeared in the web client :

   (<class 'binascii.Error'>, Error('Incorrect padding',), <traceback object at 0xb251758>

I cannot get the traceback at this moment, will post later.

Revision history for this message
Christian Sprauer (csprauer) wrote :

Hello, I found steps to reproduce:

- use the web client V6 RC 1 (this problem doesn't happen in the GTK client).
- prepare a purchase order
- go to Admin/companies. Edit the form view and add an image as Company logo. Save the image and save the form view.
- the logo is displayed in the saved form view and all seems fine.
- go to the purchase order, print the purchase order -> and error is displayed : Warning : (<class 'binascii.Error'>, Error('Incorrect padding',), <traceback object at 0x6267518>)
- go back to the Admin / Companies : The logo has disappeared !!!
- upload a picture logo again. Save the picture and then save the form view. The following error is displayed - "Write concurrency warning": This document has been modified while you were editing it. Choose:
                       - "Cancel" to cancel saving.
                       - "Write anyway" to save your current version.
- When clicking either on "Cancel" or on "Write anyway", the error continues and the report cannot be printed;
- When clicking close (top right corner of the error message pop-up), the image is saved and the reports works (see screen shot attached).

So I guess the workaround is to not click the Cancel nor the Write anyway but to just close the error window, and the reports will work. But this is quite anoying and should be fixed !

If more info is need, please let me know.

Revision history for this message
Christian Sprauer (csprauer) wrote :

Forgot to say : I used no demo data in the example I described above

Changed in openobject-addons:
status: Incomplete → Confirmed
Revision history for this message
Christophe Combelles (ccomb) wrote :

Also found this bug while trying to generate a sale order.
I've also added a logo, and I'm in a 64bit Debian Squeeze.

ERROR:web-services:[01]: Exception: Incorrect padding
ERROR:web-services:[02]: Traceback (most recent call last):
ERROR:web-services:[03]: File "/srv/openerp/sandbox/lib/python2.6/site-packages/openerp-server/service/web_services.py", line 711, in go
ERROR:web-services:[04]: (result, format) = obj.create(cr, uid, ids, datas, context)
ERROR:web-services:[05]: File "/srv/openerp/sandbox/lib/python2.6/site-packages/openerp-server/report/report_sxw.py", line 399, in create
ERROR:web-services:[06]: fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
ERROR:web-services:[07]: File "/srv/openerp/sandbox/lib/python2.6/site-packages/openerp-server/report/report_sxw.py", line 462, in create_source_pdf
ERROR:web-services:[08]: return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
ERROR:web-services:[09]: File "/srv/openerp/sandbox/lib/python2.6/site-packages/openerp-server/report/report_sxw.py", line 482, in create_single_pdf
ERROR:web-services:[10]: logo = base64.decodestring(rml_parser.logo)
ERROR:web-services:[11]: File "/usr/lib/python2.6/base64.py", line 321, in decodestring
ERROR:web-services:[12]: return binascii.a2b_base64(s)
ERROR:web-services:[13]: Error: Incorrect padding

Revision history for this message
Christophe Combelles (ccomb) wrote :

I've discovered that I was working on a restored database, and that the logo didn't appear in Administration->Société, although I had correctly added it in the original database. After setting the logo again, it works normally. It might be a problem during database restoration?

Revision history for this message
Christophe Combelles (ccomb) wrote :

Regarding the line:
ERROR:web-services:[10]: logo = base64.decodestring(rml_parser.logo)

I've pdb just before it and found that
rml_parser.logo is equal to : '/openerp/image/get_image?field=logo&model=res.company&id=1'
instead of being a base64 encoded string corresponding to the logo.

Revision history for this message
Julian Robbins (joolsr) wrote :

I've just started getting similar issues with a incorrect padding that seems to be related to use of the company logo.

Traceback (most recent call last):
  File "/usr/share/openerp-server/service/web_services.py", line 711, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/usr/share/openerp-server/report/report_sxw.py", line 399, in create
    fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
  File "/usr/share/openerp-server/report/report_sxw.py", line 462, in create_source_pdf
    return self.create_single_pdf(cr, uid, ids, data, report_xml, context)
  File "/usr/share/openerp-server/report/report_sxw.py", line 482, in create_single_pdf
    logo = base64.decodestring(rml_parser.logo)
  File "/usr/lib/python2.6/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)
Error: Incorrect padding

I'm also using 64 bit ubuntu 10.04 FWIW. Its a major annoyance if you cant change reports, so please fix

affects: openobject-addons → openobject-server
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
Changed in openobject-server:
importance: Undecided → Medium
Revision history for this message
Christophe Combelles (ccomb) wrote :

Here is a way to reproduce it : just go to administration -> company, upload a logo, save the document.
Then edit the document again, change anything in the header template in the second tab, and save the document. (Here I usually get a write conflict error.)

After that, the logo seems to be there, but I get the same Error('Incorrect padding',) when generating a PDF containing the logo.
If I go again to the company page (admin-> company), the logo is not there anymore, and I have to upload it again.

Revision history for this message
Julian Robbins (joolsr) wrote :

I think this needs fixing - very disconcerting to get apparently random errors when just trying to edit your Reports

summary: - Report generation crashes on web-client (64 Bit OS)
+ Web-client corrupts binary fields (e.g. company logo)
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Reassigning to correct project, this is indeed the web client corrupting binary/image fields in some conditions.
As Christophe found out, the base64 binary content is replaced by a URL path, such as "/openerp/image/get_image?field=logo&model=res.company&id=1"

This seems to happen mostly when a write concurrency error pops up, but I cannot seem to be able to upload a company logo via web-client without having a write concurrency error lately. (Reproduced with web client trunk revision 4123)

Temporary workaround: remove the company logo or upload it again with the GTK client.

affects: openobject-server → openobject-client-web
Changed in openobject-client-web:
assignee: OpenERP's Framework R&D (openerp-dev-framework) → OpenERP SA's Web Client R&D (openerp-dev-web)
Revision history for this message
rob allen (robertsallen) wrote :

With RC1 the webclient did upload files where the field was empty. However if you saved that record again it saved text rather than binary data.

With RC2 it doesn't even load binary data

Where widget is set to image there is also no way to add the image except when the record is new - on save and edit the image cannot be loaded.

Ubuntu 10.04 32 bit

Revision history for this message
Wei "oldrev" Li (oldrev) wrote :

In version 6rc2 GTK client, I met the same bug when I try to print the partner label report.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

I'm raising the importance of this bug report, as it can be indirectly blocking for many areas of OpenERP.
I have witnessed many cases, mostly with reports that cannot be printed (e.g. bug 699955) or employees management (Employees have pictures now).

Reminder to all: the temporary workaround is to restore the broken image(s) with the GTK client, and avoid saving forms that contain images until this bug is fixed.

Changed in openobject-client-web:
importance: Medium → High
Changed in openobject-client-web:
milestone: none → 6.0
Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

As revno: 4310 revision-id: <email address hidden>

I cannot reproduce this bug anymore (i tried scenario of both comment #5 and #11).

The way write concurrency warning works (just before rc2) has changed and we fixed binary upload (just after rc2).

I think this bug is fixed but if you find an other way to reproduce this bug please reopen it.

Changed in openobject-client-web:
status: Confirmed → Fix Released
Revision history for this message
Chertykov Denis (chertykov) wrote :

My bug https://bugs.launchpad.net/bugs/699955 was marked as duplicate of this bug.
I still can reproduce it.

1) Steps to reproduce the issue you have observed
 - Create database with demo data. (In english language)
 - Create invoice.
 - Go to 'Administration'->'Companies'->'Companies'
 - Click 'OpenERP S.A.'
 - Click Edit button
 - Click 'Header/Footer' notebook page
 - Change something in header description
 - Click Save button
 - Go to created invoice and try to print it.

2) The result you observed

Error message: (<class 'binascii.Error'>, Error('Incorrect padding',), <traceback object at 0x7fa730953cf8>)

Server output and screenshot of error in attachment.

4) The platform your are using

Ubuntu 10.10
python 2.6.6

5) The OpenERP version
trunk sevrver - revno: 3279
trunk web - revno: 4349

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

The bug is not fixed at all, even if less obvious to reproduce.
Usually as soon as you press the "Save" button after editing a company via the web client, the logo field becomes corrupted, even if it does not always look corrupted in the web client immediately. Test it by modifying the name of a company with a logo, and usually you will get it.

I can still reproduce it easily with web trunk revision 4386.. and see the other comments and duplicate bugs...

Changed in openobject-client-web:
status: Fix Released → Confirmed
Revision history for this message
Antony Lesuisse (OpenERP) (al-openerp) wrote :

refactored the binary image, fixed in commit:
revno: 4422
revision-id: <email address hidden>
revno: 4423
revision-id: <email address hidden>

Changed in openobject-client-web:
status: Confirmed → Fix Released
Revision history for this message
Alan Lord (theopensourcerer) wrote :

Am seeing the same error on Ubuntu 10.10 64bit desktop running the released openerp-client-6.0.1-tar.gz from the OpenERP website. The openerp-server_6.0.1-0_all.deb server is running on a 10.04 Ubuntu VM.

This is a newly set up system today. I *have* uploaded a company logo file for this system.

When I try and print a newly created Sales Order I get:

(<class 'binascii.Error'>, Error('Incorrect padding',),
<traceback object at 0x522fc68>)

Revision history for this message
Alan Lord (theopensourcerer) wrote :

Just FYI - I first saw this error in the GTK Client and the realised this bug was to do with the Web Client.

Just tried the Web Client to print the same Sales Order and am seeing virtually the same error:

(<class 'binascii.Error'>, Error('Incorrect padding',),
<traceback object at 0x5228050>)

Revision history for this message
Julian Robbins (joolsr) wrote :

Hi Alan

Nice to see you using OpenERP ! I used to follow your Elonex webbook blog as I have one.

If you want to get rid of your error, the workaround is to upload the logo again, or use the gtk client. Although the web client is much improved, the devs tend to use the gtk client, so it tends to be a little less buggy.

Revision history for this message
Alan Lord (theopensourcerer) wrote :

Thanks.

Workaround seemed to do the trick but it doesn't seem to me that this bug should me marked "Fixed Released" though?

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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