Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#8772 closed defect (wontfix)

KeyError: 1

Reported by: dalius@… Owned by: Remy Blank
Priority: high Milestone:
Component: general Version: 0.11.5
Severity: normal Keywords: mysql needinfo
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

How to Reproduce

While doing a POST operation on /admin/ticket/priority, Trac issued an internal error.

(please provide additional details here)

Request parameters:

{'__FORM_TOKEN': u'1d4361855ee204014785c35d',
 'apply': u'Apply changes',
 'cat_id': u'ticket',
 'default': u'NORMAL',
 'panel_id': u'priority',
 'path_info': None,
 'value_1': u'1',
 'value_2': u'2',
 'value_3': u'3',
 'value_4': u'4',
 'value_5': u'5',
 'value_6': u'6',
 'value_7': u'7'}

User Agent was: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 (.NET CLR 3.5.30729)

System Information

Trac 0.11.5
Python 2.5.2 (r252:60911, Mar 1 2008, 13:52:45)
[GCC 4.2.3]
setuptools 0.6c8
MySQL server: "5.0.51b", client: "5.0.51b", thread-safe: 0
MySQLdb 1.2.2
Genshi 0.5
mod_python 3.3.1
Subversion 1.4.6 (r28521)
jQuery: 1.2.6

Python Traceback

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Trac-0.11.5-py2.5.egg/trac/web/main.py", line 444, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.5-py2.5.egg/trac/web/main.py", line 205, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.5-py2.5.egg/trac/admin/web_ui.py", line 114, in process_request
    path_info)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.5-py2.5.egg/trac/ticket/admin.py", line 44, in render_admin_panel
    return self._render_admin_panel(req, cat, page, version)
  File "/usr/lib/python2.5/site-packages/Trac-0.11.5-py2.5.egg/trac/ticket/admin.py", line 446, in _render_admin_panel
    new_value = order[enum.value]
KeyError: 1

Attachments (1)

mysql-schema-0.11.5.sql (10.2 KB ) - added by Remy Blank 15 years ago.
Schema for 0.11.5 on MySQL.

Download all attachments as: .zip

Change History (11)

comment:1 by Remy Blank, 15 years ago

Keywords: needinfo added
Owner: set to Remy Blank

Can you give us some more information about how the priorities were set when this happened? Is the issue permanent, or was it a one-off?

comment:2 by dalius@…, 15 years ago

Well, it seems to be permanent, it always happens when i press "apply changes", yes i can add/remove/edit priorities, but on "apply changes" it dies.

comment:3 by Remy Blank, 15 years ago

Could you please provide the output of:

SELECT * FROM enum WHERE type='priority' ORDER BY value;

Does this only happen for priorities, or also for other ticket fields (ticket type, severity, …)?

comment:4 by anonymous, 15 years ago

mysql> SELECT * FROM enum WHERE type='priority' ORDER BY value; +—————+————————-+———-+ | type | name | value | +—————+————————-+———-+ | priority | ASAP | 1 | | priority | URGENT | 2 | | priority | HIGH | 3 | | priority | NORMAL | 4 | | priority | CAN WAIT | 5 | | priority | LOW | 6 | | priority | SOME TIME LATER | 7 | +—————+————————-+———-+ 7 rows in set (0.00 sec)

Yes it happens for Priorities, Resolutions, Severities, Ticket types. Others are ok.

comment:5 by dalius@…, 15 years ago

mysql> SELECT * FROM enum WHERE type='priority' ORDER BY value;
+----------+-----------------+-------+
| type     | name            | value |
+----------+-----------------+-------+
| priority | ASAP            |     1 |
| priority | URGENT          |     2 |
| priority | HIGH            |     3 |
| priority | NORMAL          |     4 |
| priority | CAN WAIT        |     5 |
| priority | LOW             |     6 |
| priority | SOME TIME LATER |     7 |
+----------+-----------------+-------+
7 rows in set (0.00 sec)

comment:6 by Remy Blank, 15 years ago

Ok, at least I know what's causing the exception: it seems that the value column in your enum table has an integer type, when it should be a text field. Could you please provide the output of:

DESC enum;

Is this a new installation, or an older one that has been updated?

comment:7 by Remy Blank, 15 years ago

Keywords: mysql added

Although I don't think this is related, you seem to have the MySQL Python bindings compiled in non-threadsafe mode, whereas the documentation explicitly states that it must be compiled in thread-safe client mode. You may want to check that as well.

comment:8 by dalius@…, 15 years ago

type varchar(32) NO PRI NULL   
name varchar(64) NO PRI NULL   
value tinyint(4) YES   NULL  

Yes its update from 10.5

comment:9 by Remy Blank, 15 years ago

Milestone: 0.11.6
Resolution: wontfix
Status: newclosed

Here's what I get on a newly-created database:

+-------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------+------+-----+---------+-------+
| type  | text | NO   | PRI | NULL    |       |
| name  | text | NO   | PRI | NULL    |       |
| value | text | YES  |     | NULL    |       |
+-------+------+------+-----+---------+-------+

So something went bad during the update from 0.10.5 (or maybe the update was manual, IIRC MySQL was flagged "experimental" in 0.10).

You will have to fix the schema for at least the enum table so that the value column has a text type. Maybe other tables are affected, too. I have attached the complete schema of a fresh 0.11.5 install, so you can compare it to your current database.

I am not MySQL-savvy enough to help you fix the schema, though, so you may want to ask for help on the MailingList or IrcChannel, where you will find people with more MySQL experience.

Closing as an InstallationIssue.

by Remy Blank, 15 years ago

Attachment: mysql-schema-0.11.5.sql added

Schema for 0.11.5 on MySQL.

comment:10 by dalius@…, 15 years ago

Thnx changing type into "text" fixed the problem :)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.