Modify

Opened 3 years ago

Closed 20 months ago

#9246 closed defect (fixed)

InternalError when refresh_passwd = true

Reported by: wizpig64 Owned by: hasienda
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords: refresh_passwd password refresh
Cc: Trac Release: 0.11

Description

Was really going insane with configuring my new trac server and this plugin, until i started over and logged out and in at each step. Found the issue here, when Admin > Accounts > Configuration > Password Refresh is enabled.

I found and disabled it here in the trac.ini file:

[account-manager]
refresh_passwd = false

When the above is enabled, logging in gives this error, likely during the process which re-encrypts the password of course:

Traceback (most recent call last):
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 440, in send_error
    data, 'text/html')
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\chrome.py", line 827, in render_template
    message = req.session.pop('chrome.%s.%d' % (type_, i))
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__
    value = self.callbacks[name](self)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 300, in _get_session
    return Session(self.env, req)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\session.py", line 192, in __init__
    if req.authname == 'anonymous':
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__
    value = self.callbacks[name](self)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 159, in authenticate
    authname = authenticator.authenticate(req)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 489, in wrap
    return func(self, *args, **kwds)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 510, in authenticate
    user = self._remote_user(req)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 790, in _remote_user
    if acctmgr.check_password(user, password) == True:
  File "build\bdist.win32\egg\acct_mgr\api.py", line 306, in check_password
    valid = store.check_password(user, password)
  File "build\bdist.win32\egg\acct_mgr\db.py", line 99, in check_password
    """, (self.key, user))
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\db\util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
InternalError: current transaction is aborted, commands ignored until end of transaction block

If there's any more information i can give about my setup that might be causing this, let me know how I can help.

Attachments (0)

Change History (9)

comment:1 in reply to: ↑ description Changed 3 years ago by hasienda

  • Keywords changed from refresh_passwd, password refresh to refresh_passwd password refresh
  • Summary changed from InternalError when password refresh = true to InternalError when refresh_passwd = true

Replying to wizpig64:

If there's any more information i can give about my setup that might be causing this, let me know how I can help.

Sure you can: First tell me your exact plugin revision/version. Obviously knowing the db backend (SQLite or ...) would be good to know too. Enable DEBUG logging to see, what are the arguments to the SQL query that bails out. Just to name immediate questions that pop up in my mind.

This failure is not apparently clear to me. I'm using the code in production for months, even the SessionStore for the rather new refresh password feature. Anything worked by now, admittedly not on a Win system but Debian GNU/Linux. Anyway, let's see, what we can do, if you come up with more details. Sharing your experience is appreciated, as this is the only way to improve software especially in less common applications.

Btw, refresh_passwd boolean option defaults to False, so you should possibly consider to enable less features next time when starting a new applications.

comment:2 follow-up: Changed 3 years ago by wizpig64

Our setup is:

  • Windows XP 64bit (yes, i know)
  • PostgreSQL 9.0 (also due for an update to .0.5)
  • Apache 2.2
  • Trac 0.12.2

Debug information being added back up to the main post, for sanity.

I have moderate experience with Python and Postgres (Building a website in Django for the company right now is my main project), but little with the inner workings of Trac. I would love to be able to help out with the fix though.

comment:3 in reply to: ↑ 2 Changed 3 years ago by wizpig64

Welll i guess i can't edit the top post but:

2011-10-06 17:50:31,003 Trac[main] DEBUG: Dispatching <Request "POST '/login'">
2011-10-06 17:50:31,003 Trac[api] INFO: Synchronized '' repository in 0.00 seconds
2011-10-06 17:50:31,003 Trac[main] ERROR: Exception caught while post-processing request: 
Traceback (most recent call last):
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 270, in dispatch
    self._post_process_request(req)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 359, in _post_process_request
    f.post_process_request(req, *(None,)*extra_arg_count)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 887, in post_process_request
    if not req.session.authenticated:
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__
    value = self.callbacks[name](self)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 300, in _get_session
    return Session(self.env, req)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\session.py", line 192, in __init__
    if req.authname == 'anonymous':
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__
    value = self.callbacks[name](self)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 159, in authenticate
    authname = authenticator.authenticate(req)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 489, in wrap
    return func(self, *args, **kwds)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 510, in authenticate
    user = self._remote_user(req)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 790, in _remote_user
    if acctmgr.check_password(user, password) == True:
  File "build\bdist.win32\egg\acct_mgr\api.py", line 306, in check_password
    valid = store.check_password(user, password)
  File "build\bdist.win32\egg\acct_mgr\db.py", line 99, in check_password
    """, (self.key, user))
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\db\util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
InternalError: current transaction is aborted, commands ignored until end of transaction block
InternalError: current transaction is aborted, commands ignored until end of transaction block

2011-10-06 17:50:31,019 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 511, in _dispatch_request
    dispatcher.dispatch(req)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 202, in dispatch
    chosen_handler)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 344, in _pre_process_request
    chosen_handler = filter_.pre_process_request(req, chosen_handler)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 870, in pre_process_request
    if not req.session.authenticated:
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__
    value = self.callbacks[name](self)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 300, in _get_session
    return Session(self.env, req)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\session.py", line 192, in __init__
    if req.authname == 'anonymous':
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\api.py", line 216, in __getattr__
    value = self.callbacks[name](self)
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\web\main.py", line 159, in authenticate
    authname = authenticator.authenticate(req)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 489, in wrap
    return func(self, *args, **kwds)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 510, in authenticate
    user = self._remote_user(req)
  File "build\bdist.win32\egg\acct_mgr\web_ui.py", line 790, in _remote_user
    if acctmgr.check_password(user, password) == True:
  File "build\bdist.win32\egg\acct_mgr\api.py", line 310, in check_password
    self._maybe_update_hash(user, password)
  File "build\bdist.win32\egg\acct_mgr\api.py", line 428, in _maybe_update_hash
    cursor.execute(sql, (user,))
  File "c:\docume~1\david\locals~1\temp\easy_install-gddpnv\Trac-0.12.2-py2.6-win32.egg.tmp\trac\db\util.py", line 65, in execute
    return self.cursor.execute(sql_escape_percent(sql), args)
ProgrammingError: operator does not exist: text = integer
LINE 6:                 AND value=1
                                 ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
ProgrammingError: operator does not exist: text = integer
LINE 6:                 AND value=1
                                 ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

comment:4 Changed 3 years ago by hasienda

  • Status changed from new to assigned

XP? Never mind, been there, done that too. Sooner or later you'll want to take a look at alternatives... Anyway Trac already tries hard to abstract OS specific things, so in general for plugins an OS agnostic approach should be fine.

How about that micro-patch then:

  • accountmanagerplugin/trunk/acct_mgr/api.py

    diff --git a/accountmanagerplugin/trunk/acct_mgr/api.py b/accountmanagerplugin/trunk/acct_mgr/api.py
    a b  
    423423              FROM  session_attribute 
    424424            WHERE   sid=%s 
    425425                AND name='password_refreshed' 
    426                 AND value=1 
     426                AND value='1' 
    427427            """ 
    428428        cursor.execute(sql, (user,)) 
    429429        if cursor.fetchone() is None: 

comment:5 Changed 3 years ago by wizpig64

I rebuilt the egg with this change and everything works fine now. Looking back, I may have been able to do some deeper investigating and done this myself, but now I know where to look and help out if another issue pops up in the future. Either way, thanks for your help, and for the great plugin!

comment:6 Changed 3 years ago by hasienda

Hey, I enjoy this as well. Thanks for the instant feedback.

Just for clarification: I'll leave this open until the change is incorporated into a proper release.

comment:7 Changed 3 years ago by hasienda

(In [10747]) AccountManagerPlugin: Change SQL to mach type, refs #9246.

Another time PostgeSQL has been pickier than others, but correct after all.

comment:8 Changed 3 years ago by wizpig64

That's why I left it alone as well :)

comment:9 Changed 20 months ago by hasienda

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [12398]) AccountManagerPlugin: Releasing version 0.4, pushing development to acct_mgr-0.5dev.

Availability of that code as stable release
closes #874, #3459, #4677, #5295, #5691, #6616, #7577, #8076, #8685, #8770, #8791, #8990, #9052, #9079, #9090, #9139, #9246, #9252, #9547, #9618, #9676, #9843, #9852, #9940, #10023, #10028, #10123, #10142, #10204, #10276, #10397, #10412, #10594, #10625 and #10644.

Some more issues have been worked-on, yet without confirmed resolution,
refs #5464 (for JiraToTracIntegration), #8927 and #10134.

And finally there are some issues and enhancement requests showing progress,
but known to require more work to resolve them satisfactorily,
refs #843, #1600, #5964, #8217, #8933.

Thanks to all contributors and followers, that enabled and encouraged a good
portion of this development work.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from hasienda. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.