View Issue Details

IDProjectCategoryView StatusLast Update
0006634Talerobsolete componentpublic2021-08-24 16:23
ReporterChristian Grothoff Assigned ToMS  
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionfixed 
Platformi7OSDebian GNU/LinuxOS Versionsqueeze
Product Versiongit (master) 
Target Version0.8Fixed in Version0.8 
Summary0006634: bank throws unnice stack trace on configuration failure
DescriptionIf the database option is not set in the configuration, I get:

Traceback (most recent call last):
  File "/home/grothoff/.local/bin/taler-bank-manage", line 188, in <module>
    ARGS.func(ARGS)
  File "/home/grothoff/.local/bin/taler-bank-manage", line 54, in handle_django
    django.setup()
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__
    self._setup(name)
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 70, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/conf/__init__.py", line 177, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/grothoff/.local/lib/python3.8/site-packages/talerbank/settings.py", line 104, in <module>
    DBNAME = TC.value_string("bank", "database", required=True)
  File "/home/grothoff/.local/lib/python3.8/site-packages/taler/util/talerconfig.py", line 391, in value_string
    return self.sections[section][option].value_string(
  File "/home/grothoff/.local/lib/python3.8/site-packages/taler/util/talerconfig.py", line 173, in value_string
    raise ConfigurationError(
taler.util.talerconfig.ConfigurationError: Missing required option 'DATABASE' in section 'BANK'
Failed to setup database `postgres:///talerbank'

The code should be changed to ONLY output the " Missing required option 'DATABASE' in section 'BANK'" text
(maybe with "in the configuration file" or something like that), but please NO exception stacktraces. They are a sign of BAD error handling.
TagsNo tags attached.

Activities

Christian Grothoff

2020-10-30 17:52

manager   ~0017069

Here is another one:

.Traceback (most recent call last):
  File "/home/grothoff/.local/bin/taler-bank-manage", line 188, in <module>
    ARGS.func(ARGS)
  File "/home/grothoff/.local/bin/taler-bank-manage", line 92, in handle_serve
    serve = TC["bank"]["serve"].value_string(required=True).lower()
  File "/home/grothoff/.local/lib/python3.8/site-packages/taler/util/talerconfig.py", line 173, in value_string
    raise ConfigurationError(
taler.util.talerconfig.ConfigurationError: Missing required option 'SERVE' in section 'BANK'

Christian Grothoff

2020-10-30 21:47

manager   ~0017071

One more, totally strange error message:

$ taler-bank-manage -c test_merchant_api.conf
Traceback (most recent call last):
  File "/home/grothoff/.local/bin/taler-bank-manage", line 188, in <module>
    ARGS.func(ARGS)
TypeError: 'NoneType' object is not callable

Christian Grothoff

2020-10-30 22:58

manager   ~0017072

Also now getting this exception trace in the log, which makes no sense:
2020-10-30 21:50:16,309 middleware ERROR Error: Aborting payment initiated by '43', debit limit -EUR:50 crossed., while serving /taler-wire-gateway/Exchange/admin/add-incoming
2020-10-30 21:50:16,310 middleware ERROR Stack trace: Traceback (most recent call last):
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/core/handlers/base.py", line 179, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/grothoff/.local/lib/python3.8/site-packages/django/views/decorators/http.py", line 40, in inner
    return func(request, *args, **kwargs)
  File "/home/grothoff/.local/lib/python3.8/site-packages/talerbank/app/views.py", line 89, in _decorator
    return view_func(request, user_account, *args, **kwargs)
  File "/home/grothoff/.local/lib/python3.8/site-packages/talerbank/app/views.py", line 862, in twg_add_incoming
    wtrans = wire_transfer(amount, debit_account, exchange_account, subject,)
  File "/home/grothoff/.local/lib/python3.8/site-packages/talerbank/app/views.py", line 1309, in wire_transfer
    raise DebitLimitException(
talerbank.app.views.DebitLimitException: Aborting payment initiated by '43', debit limit -EUR:50 crossed.

Forbidden: /taler-wire-gateway/Exchange/admin/add-incoming

The last log message (Aborting payment initiated by '43', debit limit -EUR:50 crossed.) makes sense and should be logged. But why the stack trace for something we *expect*???

MS

2020-11-02 16:07

reporter   ~0017081

Last edited: 2020-11-02 16:13

@0017072 : it was some extra measure of error tracking. Basically, the exception does get correctly managed, but the server *still* prints the stack trace.

Changed here, not to print the extra debug: a2dcd40b7b933c3c9cbefdad3e87e70421c8cf14

Christian Grothoff

2020-11-02 16:08

manager   ~0017082

I know, and what I am saying is that it should not.

MS

2020-11-02 18:19

reporter   ~0017085

From this commit on: b582c99cccaa36724ea1b79a499e59f908d7a401 @ taler-util.git, there should be no stack trace printed upon missing configuration values.
Please note this other issue (0006636) before trying the new code!

MS

2020-11-02 19:03

reporter   ~0017086

This commit: 915bca1c343dbb8f6a11f9acb437730eaa219eda, fixes what reported under note 0017071.

MS

2020-11-02 19:12

reporter   ~0017087

Closing: all the points got addressed.

Issue History

Date Modified Username Field Change
2020-10-30 17:47 Christian Grothoff New Issue
2020-10-30 17:47 Christian Grothoff Status new => assigned
2020-10-30 17:47 Christian Grothoff Assigned To => MS
2020-10-30 17:52 Christian Grothoff Note Added: 0017069
2020-10-30 21:47 Christian Grothoff Note Added: 0017071
2020-10-30 22:58 Christian Grothoff Note Added: 0017072
2020-11-02 16:07 MS Note Added: 0017081
2020-11-02 16:08 Christian Grothoff Note Added: 0017082
2020-11-02 16:13 MS Note Edited: 0017081
2020-11-02 18:19 MS Note Added: 0017085
2020-11-02 19:03 MS Note Added: 0017086
2020-11-02 19:12 MS Status assigned => resolved
2020-11-02 19:12 MS Resolution open => fixed
2020-11-02 19:12 MS Note Added: 0017087
2021-07-30 13:57 Christian Grothoff Fixed in Version => 0.8
2021-07-30 14:02 Christian Grothoff Target Version 0.8.1 => 0.8
2021-08-24 16:23 Christian Grothoff Status resolved => closed
2022-08-23 20:26 Christian Grothoff Category bank (demonstrator) => py bank (demonstrator, obsolete)
2023-12-03 01:23 Christian Grothoff Category py bank (demonstrator, obsolete) => obsolete componet
2023-12-11 20:08 Florian Dold Category obsolete componet => obsolete component