bugGNU Health - Bugs: bug #62608, health webdav not running

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62608: health webdav not running

Submitter:  Gerald Wiese <gerald_wiese>
Submitted:  Thu 09 Jun 2022 12:26:25 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Release:  None
Module:  health_webdav Component:  Hospital Management

Jump to the original submission

Fri 20 Jan 2023 05:57:05 PM UTC, comment #13: 

The bug I opened seems fixed, other problems should be discussed here I guess:
https://savannah.gnu.org/bugs/?62792

Gerald Wiese <gerald_wiese>
Group Member
Thu 21 Jul 2022 12:15:24 PM UTC, comment #12: 

Which request triggered that?
And can you translate the words around "favicon.ico"?
In the screenshot below I see version 4.0.1, did you test 4.0.4 as well?
Can't find "favicon.ico" outside hidden files in .hg directory (mercurial repo).

comment #11:

> ```
> Exception occurred during processing of request from ('::ffff:127.0.0.1', 38532, 0, 0)
> Traceback (most recent call last):
>   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
>     self.finish_request(request, client_address)
>   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
>     self.RequestHandlerClass(request, client_address, self)
>   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
>     self.handle()
>   File "/usr/lib/python3.9/http/server.py", line 427, in handle
>     self.handle_one_request()
>   File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
>     if not self.parse_request():
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 578, in parse_request
>     if not self.get_userinfo(user, password, self.command):
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 590, in get_userinfo
>     with Transaction().start(dbname, 0, close=True) as transaction:
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/transaction.py", line 107, in start
>     database = backend.Database(database_name).connect()
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/backend/postgresql/database.py", line 230, in _new_
>     inst._connpool = ThreadedConnectionPool(
>   File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 161, in _init_
>     AbstractConnectionPool.__init__(
>   File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 59, in _init_
>     self._connect()
>   File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 63, in _connect
>     conn = psycopg2.connect(self._args, *self._kwargs)
>   File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
>     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
> psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: 致命错误:  数据库 "favicon.ico" 不存在
> ```
>
> what favicon.ico use for?


Gerald Wiese <gerald_wiese>
Group Member
Thu 21 Jul 2022 09:57:55 AM UTC, comment #11: 

```
Exception occurred during processing of request from ('::ffff:127.0.0.1', 38532, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
    self.handle()
  File "/usr/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
    if not self.parse_request():
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 578, in parse_request
    if not self.get_userinfo(user, password, self.command):
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 590, in get_userinfo
    with Transaction().start(dbname, 0, close=True) as transaction:
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/transaction.py", line 107, in start
    database = backend.Database(database_name).connect()
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/backend/postgresql/database.py", line 230, in _new_
    inst._connpool = ThreadedConnectionPool(
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 161, in _init_
    AbstractConnectionPool.__init__(
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 59, in _init_
    self._connect()
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/pool.py", line 63, in _connect
    conn = psycopg2.connect(self._args, *self._kwargs)
  File "/home/feng/.local/lib/python3.9/site-packages/psycopg2/__init__.py", line 122, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: connection to server at "localhost" (::1), port 5432 failed: 致命错误:  数据库 "favicon.ico" 不存在
```

what favicon.ico use for?


comment #9:

> Great :)
> Should be a different issue, I remember this was a problem in 3.8 as well. This issue here was coming from 4.0 upgrade.
> Let's open another one for that?


agree.

> And commit the changes by end of the week if nobody proposes an alternative way to handle the cache?
>
> comment #8:
> > I have test this diff, webdav seem to work.
> >
> > I have tested caldav with thunderbird and evolution too,  I think both of them can not work well.
> > the events created in thunderbird and evolution can be found in gnuhealth-client, but events created in gnuhealth-client
> > can not be showed in thunderbird or evolution.
> >
> > Is this the same issue or the different issues? I do not know.
> >
> >
> >
> > comment #7:
> > > For me using the attached protocol.py it's working (see .diff for changes)
> > >
> > > comment #3:
> > > >
> > > > comment #1:
> > > > > Dear Gerald
> > > > >
> > > > > Thank you for reporting!
> > > > >
> > > > > I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.
> > > >
> > > > I think os package is not in health_webdav3_server/bin dir.
> > > >
> > > >
> > > > >
> > > > > It seems to run OK on my box...
> > > > >
> > > > > lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
> > > > > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
> > > > > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
> > > > > 2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080
> > > > >
> > > >
> > > > I have tested in my machine, when run ./gnuhealth-webdav-server -vv, no error, but if your browser http://localhost:8080/ in firefox,
> > > > the below error will be exist
> > > >
> > > > ```
> > > > ----------------------------------------
> > > > Exception occurred during processing of request from ('::ffff:127.0.0.1', 58212, 0, 0)
> > > > Traceback (most recent call last):
> > > >   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
> > > >     self.finish_request(request, client_address)
> > > >   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
> > > >     self.RequestHandlerClass(request, client_address, self)
> > > >   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
> > > >     self.handle()
> > > >   File "/usr/lib/python3.9/http/server.py", line 427, in handle
> > > >     self.handle_one_request()
> > > >   File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request
> > > >     method()
> > > >   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 296, in do_GET
> > > >     status_code = self._HEAD_GET(with_body=True)
> > > >   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 262, in _HEAD_GET
> > > >     data = dc.get_data(uri, range)
> > > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 254, in get_data
> > > >     'GNU Health</a> version %s</em>' % os.environ['GNUHEALTH_VERSION'])
> > > > NameError: name 'os' is not defined
> > > > ----------------------------------------
> > > >
> > > >
> > > > ```
> > > >
> > > >
> > > > I add 'import os' to protocol.py, 'NameError: name 'os' is not defined' is dispear.
> > > >
> > > >
> > > > when I vistit http://localhost:8080/gnuhealth1in firefox, the following error exist:
> > > >
> > > > ```
> > > > ----------------------------------------
> > > > Exception occurred during processing of request from ('::ffff:127.0.0.1', 57936, 0, 0)
> > > > Traceback (most recent call last):
> > > >   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
> > > >     self.handle()
> > > >   File "/usr/lib/python3.9/http/server.py", line 427, in handle
> > > >     self.handle_one_request()
> > > >   File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
> > > >     if not self.parse_request():
> > > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 577, in parse_request
> > > >     if not self.get_userinfo(user, password, self.command):
> > > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 622, in get_userinfo
> > > >     Cache.clean(dbname)
> > > > AttributeError: type object 'MemoryCache' has no attribute 'clean'
> > > >
> > > > During handling of the above exception, another exception occurred:
> > > >
> > > > Traceback (most recent call last):
> > > >   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
> > > >     self.finish_request(request, client_address)
> > > >   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
> > > >     self.RequestHandlerClass(request, client_address, self)
> > > >   File "/usr/lib/python3.9/socketserver.py", line 722, in _init_
> > > >     self.finish()
> > > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 561, in finish
> > > >     Cache.resets(dbname)
> > > > AttributeError: type object 'MemoryCache' has no attribute 'resets'
> > > > ----------------------------------------
> > > >
> > > > ```
> > > >
> > > >
> > > >
> > > >
> > > >

Feng Shu <tumashu>
Thu 21 Jul 2022 09:56:30 AM UTC, comment #10: 

Firefox seem to have showing problem when open webdav link, is it firefox's issue or health_webdav's issue?
chromum have no this problem.

please see attachment.


Feng Shu <tumashu>
Thu 21 Jul 2022 09:22:00 AM UTC, comment #9: 

Great :)
Should be a different issue, I remember this was a problem in 3.8 as well. This issue here was coming from 4.0 upgrade.
Let's open another one for that?
And commit the changes by end of the week if nobody proposes an alternative way to handle the cache?

comment #8:

> I have test this diff, webdav seem to work.
>
> I have tested caldav with thunderbird and evolution too,  I think both of them can not work well.
> the events created in thunderbird and evolution can be found in gnuhealth-client, but events created in gnuhealth-client
> can not be showed in thunderbird or evolution.
>
> Is this the same issue or the different issues? I do not know.
>
>
>
> comment #7:
> > For me using the attached protocol.py it's working (see .diff for changes)
> >
> > comment #3:
> > >
> > > comment #1:
> > > > Dear Gerald
> > > >
> > > > Thank you for reporting!
> > > >
> > > > I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.
> > >
> > > I think os package is not in health_webdav3_server/bin dir.
> > >
> > >
> > > >
> > > > It seems to run OK on my box...
> > > >
> > > > lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
> > > > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
> > > > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
> > > > 2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080
> > > >
> > >
> > > I have tested in my machine, when run ./gnuhealth-webdav-server -vv, no error, but if your browser http://localhost:8080/ in firefox,
> > > the below error will be exist
> > >
> > > ```
> > > ----------------------------------------
> > > Exception occurred during processing of request from ('::ffff:127.0.0.1', 58212, 0, 0)
> > > Traceback (most recent call last):
> > >   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
> > >     self.finish_request(request, client_address)
> > >   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
> > >     self.RequestHandlerClass(request, client_address, self)
> > >   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
> > >     self.handle()
> > >   File "/usr/lib/python3.9/http/server.py", line 427, in handle
> > >     self.handle_one_request()
> > >   File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request
> > >     method()
> > >   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 296, in do_GET
> > >     status_code = self._HEAD_GET(with_body=True)
> > >   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 262, in _HEAD_GET
> > >     data = dc.get_data(uri, range)
> > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 254, in get_data
> > >     'GNU Health</a> version %s</em>' % os.environ['GNUHEALTH_VERSION'])
> > > NameError: name 'os' is not defined
> > > ----------------------------------------
> > >
> > >
> > > ```
> > >
> > >
> > > I add 'import os' to protocol.py, 'NameError: name 'os' is not defined' is dispear.
> > >
> > >
> > > when I vistit http://localhost:8080/gnuhealth1in firefox, the following error exist:
> > >
> > > ```
> > > ----------------------------------------
> > > Exception occurred during processing of request from ('::ffff:127.0.0.1', 57936, 0, 0)
> > > Traceback (most recent call last):
> > >   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
> > >     self.handle()
> > >   File "/usr/lib/python3.9/http/server.py", line 427, in handle
> > >     self.handle_one_request()
> > >   File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
> > >     if not self.parse_request():
> > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 577, in parse_request
> > >     if not self.get_userinfo(user, password, self.command):
> > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 622, in get_userinfo
> > >     Cache.clean(dbname)
> > > AttributeError: type object 'MemoryCache' has no attribute 'clean'
> > >
> > > During handling of the above exception, another exception occurred:
> > >
> > > Traceback (most recent call last):
> > >   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
> > >     self.finish_request(request, client_address)
> > >   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
> > >     self.RequestHandlerClass(request, client_address, self)
> > >   File "/usr/lib/python3.9/socketserver.py", line 722, in _init_
> > >     self.finish()
> > >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 561, in finish
> > >     Cache.resets(dbname)
> > > AttributeError: type object 'MemoryCache' has no attribute 'resets'
> > > ----------------------------------------
> > >
> > > ```
> > >
> > >
> > >
> > >
> > >

Gerald Wiese <gerald_wiese>
Group Member
Thu 21 Jul 2022 09:18:31 AM UTC, comment #8: 

I have test this diff, webdav seem to work.

I have tested caldav with thunderbird and evolution too,  I think both of them can not work well.
the events created in thunderbird and evolution can be found in gnuhealth-client, but events created in gnuhealth-client
can not be showed in thunderbird or evolution.

Is this the same issue or the different issues? I do not know.



comment #7:

> For me using the attached protocol.py it's working (see .diff for changes)
>
> comment #3:
> >
> > comment #1:
> > > Dear Gerald
> > >
> > > Thank you for reporting!
> > >
> > > I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.
> >
> > I think os package is not in health_webdav3_server/bin dir.
> >
> >
> > >
> > > It seems to run OK on my box...
> > >
> > > lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
> > > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
> > > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
> > > 2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080
> > >
> >
> > I have tested in my machine, when run ./gnuhealth-webdav-server -vv, no error, but if your browser http://localhost:8080/ in firefox,
> > the below error will be exist
> >
> > ```
> > ----------------------------------------
> > Exception occurred during processing of request from ('::ffff:127.0.0.1', 58212, 0, 0)
> > Traceback (most recent call last):
> >   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
> >     self.finish_request(request, client_address)
> >   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
> >     self.RequestHandlerClass(request, client_address, self)
> >   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
> >     self.handle()
> >   File "/usr/lib/python3.9/http/server.py", line 427, in handle
> >     self.handle_one_request()
> >   File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request
> >     method()
> >   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 296, in do_GET
> >     status_code = self._HEAD_GET(with_body=True)
> >   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 262, in _HEAD_GET
> >     data = dc.get_data(uri, range)
> >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 254, in get_data
> >     'GNU Health</a> version %s</em>' % os.environ['GNUHEALTH_VERSION'])
> > NameError: name 'os' is not defined
> > ----------------------------------------
> >
> >
> > ```
> >
> >
> > I add 'import os' to protocol.py, 'NameError: name 'os' is not defined' is dispear.
> >
> >
> > when I vistit http://localhost:8080/gnuhealth1in firefox, the following error exist:
> >
> > ```
> > ----------------------------------------
> > Exception occurred during processing of request from ('::ffff:127.0.0.1', 57936, 0, 0)
> > Traceback (most recent call last):
> >   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
> >     self.handle()
> >   File "/usr/lib/python3.9/http/server.py", line 427, in handle
> >     self.handle_one_request()
> >   File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
> >     if not self.parse_request():
> >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 577, in parse_request
> >     if not self.get_userinfo(user, password, self.command):
> >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 622, in get_userinfo
> >     Cache.clean(dbname)
> > AttributeError: type object 'MemoryCache' has no attribute 'clean'
> >
> > During handling of the above exception, another exception occurred:
> >
> > Traceback (most recent call last):
> >   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
> >     self.finish_request(request, client_address)
> >   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
> >     self.RequestHandlerClass(request, client_address, self)
> >   File "/usr/lib/python3.9/socketserver.py", line 722, in _init_
> >     self.finish()
> >   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 561, in finish
> >     Cache.resets(dbname)
> > AttributeError: type object 'MemoryCache' has no attribute 'resets'
> > ----------------------------------------
> >
> > ```
> >
> >
> >
> >
> >

Feng Shu <tumashu>
Wed 20 Jul 2022 12:59:51 PM UTC, comment #7: 

For me using the attached protocol.py it's working (see .diff for changes)

comment #3:

>
> comment #1:
> > Dear Gerald
> >
> > Thank you for reporting!
> >
> > I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.
>
> I think os package is not in health_webdav3_server/bin dir.
>
>
> >
> > It seems to run OK on my box...
> >
> > lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
> > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
> > 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
> > 2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080
> >
>
> I have tested in my machine, when run ./gnuhealth-webdav-server -vv, no error, but if your browser http://localhost:8080/ in firefox,
> the below error will be exist
>
> ```
> ----------------------------------------
> Exception occurred during processing of request from ('::ffff:127.0.0.1', 58212, 0, 0)
> Traceback (most recent call last):
>   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
>     self.finish_request(request, client_address)
>   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
>     self.RequestHandlerClass(request, client_address, self)
>   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
>     self.handle()
>   File "/usr/lib/python3.9/http/server.py", line 427, in handle
>     self.handle_one_request()
>   File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request
>     method()
>   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 296, in do_GET
>     status_code = self._HEAD_GET(with_body=True)
>   File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 262, in _HEAD_GET
>     data = dc.get_data(uri, range)
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 254, in get_data
>     'GNU Health</a> version %s</em>' % os.environ['GNUHEALTH_VERSION'])
> NameError: name 'os' is not defined
> ----------------------------------------
>
>
> ```
>
>
> I add 'import os' to protocol.py, 'NameError: name 'os' is not defined' is dispear.
>
>
> when I vistit http://localhost:8080/gnuhealth1in firefox, the following error exist:
>
> ```
> ----------------------------------------
> Exception occurred during processing of request from ('::ffff:127.0.0.1', 57936, 0, 0)
> Traceback (most recent call last):
>   File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
>     self.handle()
>   File "/usr/lib/python3.9/http/server.py", line 427, in handle
>     self.handle_one_request()
>   File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
>     if not self.parse_request():
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 577, in parse_request
>     if not self.get_userinfo(user, password, self.command):
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 622, in get_userinfo
>     Cache.clean(dbname)
> AttributeError: type object 'MemoryCache' has no attribute 'clean'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
>     self.finish_request(request, client_address)
>   File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
>     self.RequestHandlerClass(request, client_address, self)
>   File "/usr/lib/python3.9/socketserver.py", line 722, in _init_
>     self.finish()
>   File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 561, in finish
>     Cache.resets(dbname)
> AttributeError: type object 'MemoryCache' has no attribute 'resets'
> ----------------------------------------
>
> ```
>
>
>
>
>

Gerald Wiese <gerald_wiese>
Group Member
Wed 20 Jul 2022 12:33:32 AM UTC, comment #6: 

```
----------------------------------------
Exception occurred during processing of request from ('::ffff:127.0.0.1', 39758, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
    self.handle()
  File "/usr/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request
    method()
  File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 620, in do_PUT
    dc.put(uri, body, content_type)
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 303, in put
    if res:
UnboundLocalError: local variable 'res' referenced before assignment
----------------------------------------

```

Feng Shu <tumashu>
Wed 20 Jul 2022 12:15:52 AM UTC, comment #5: 

Sorry, the error is like below:

```
Traceback (most recent call last):
  File "/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 46, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 84, in auth_required
    return wrapped(args, *kwargs)
  File "/trytond/protocols/wrappers.py", line 159, in wrapper
    return func(request, pool, args, *kwargs)
  File "/trytond/protocols/dispatcher.py", line 180, in _dispatch
    result = rpc.result(meth(c_args, *c_kwargs))
  File "/trytond/model/modelsql.py", line 870, in read
    getter_results = field.get(
  File "/trytond/model/fields/function.py", line 105, in get
    return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 105, in <genexpr>
    return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 100, in call
    return dict((r.id, method(r, name)) for r in records)
  File "/trytond/model/fields/function.py", line 100, in <genexpr>
    return dict((r.id, method(r, name)) for r in records)
  File "/trytond/modules/health_webdav3_server/webdav.py", line 666, in get_url
    return urllib.parse.urljoin(get_webdav_url(),
  File "/trytond/modules/health_webdav3_server/webdav.py", line 38, in get_webdav_url
    or str(socket.getfqdn(), 'utf8'))
NameError: name 'socket' is not defined

Fault: name 'socket' is not defined
```


comment #4:

> When I add a share, the following error is exist:
>
> ```
> Traceback (most recent call last):
>   File "/trytond/wsgi.py", line 117, in dispatch_request
>     return endpoint(request, **request.view_args)
>   File "/trytond/protocols/dispatcher.py", line 46, in rpc
>     return methods.get(request.rpc_method, _dispatch)(
>   File "/trytond/wsgi.py", line 84, in auth_required
>     return wrapped(args, *kwargs)
>   File "/trytond/protocols/wrappers.py", line 159, in wrapper
>     return func(request, pool, args, *kwargs)
>   File "/trytond/protocols/dispatcher.py", line 180, in _dispatch
>     result = rpc.result(meth(c_args, *c_kwargs))
>   File "/trytond/model/modelsql.py", line 870, in read
>     getter_results = field.get(
>   File "/trytond/model/fields/function.py", line 105, in get
>     return dict((name, call(name)) for name in names)
>   File "/trytond/model/fields/function.py", line 105, in <genexpr>
>     return dict((name, call(name)) for name in names)
>   File "/trytond/model/fields/function.py", line 100, in call
>     return dict((r.id, method(r, name)) for r in records)
>   File "/trytond/model/fields/function.py", line 100, in <genexpr>
>     return dict((r.id, method(r, name)) for r in records)
>   File "/trytond/modules/health_webdav3_server/webdav.py", line 666, in get_url
>     def get_url(self, name):
>   File "/trytond/modules/health_webdav3_server/webdav.py", line 40, in get_webdav_url
>     hostname = '.'.join(encodings.idna.ToASCII(part) for
> AttributeError: 'NoneType' object has no attribute 'split'
>
> Fault: 'NoneType' object has no attribute 'split'
> ```

Feng Shu <tumashu>
Wed 20 Jul 2022 12:12:28 AM UTC, comment #4: 

When I add a share, the following error is exist:

```
Traceback (most recent call last):
  File "/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 46, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/trytond/wsgi.py", line 84, in auth_required
    return wrapped(args, *kwargs)
  File "/trytond/protocols/wrappers.py", line 159, in wrapper
    return func(request, pool, args, *kwargs)
  File "/trytond/protocols/dispatcher.py", line 180, in _dispatch
    result = rpc.result(meth(c_args, *c_kwargs))
  File "/trytond/model/modelsql.py", line 870, in read
    getter_results = field.get(
  File "/trytond/model/fields/function.py", line 105, in get
    return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 105, in <genexpr>
    return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 100, in call
    return dict((r.id, method(r, name)) for r in records)
  File "/trytond/model/fields/function.py", line 100, in <genexpr>
    return dict((r.id, method(r, name)) for r in records)
  File "/trytond/modules/health_webdav3_server/webdav.py", line 666, in get_url
    def get_url(self, name):
  File "/trytond/modules/health_webdav3_server/webdav.py", line 40, in get_webdav_url
    hostname = '.'.join(encodings.idna.ToASCII(part) for
AttributeError: 'NoneType' object has no attribute 'split'

Fault: 'NoneType' object has no attribute 'split'
```

Feng Shu <tumashu>
Tue 19 Jul 2022 11:58:16 PM UTC, comment #3: 


comment #1:

> Dear Gerald
>
> Thank you for reporting!
>
> I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.


I think os package is not in health_webdav3_server/bin dir.


>
> It seems to run OK on my box...
>
> lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
> 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
> 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
> 2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080
>


I have tested in my machine, when run ./gnuhealth-webdav-server -vv, no error, but if your browser http://localhost:8080/ in firefox,
the below error will be exist

```
----------------------------------------
Exception occurred during processing of request from ('::ffff:127.0.0.1', 58212, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
    self.handle()
  File "/usr/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.9/http/server.py", line 415, in handle_one_request
    method()
  File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 296, in do_GET
    status_code = self._HEAD_GET(with_body=True)
  File "/home/feng/.local/lib/python3.9/site-packages/pywebdav/lib/WebDAVServer.py", line 262, in _HEAD_GET
    data = dc.get_data(uri, range)
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 254, in get_data
    'GNU Health</a> version %s</em>' % os.environ['GNUHEALTH_VERSION'])
NameError: name 'os' is not defined
----------------------------------------


```


I add 'import os' to protocol.py, 'NameError: name 'os' is not defined' is dispear.


when I vistit http://localhost:8080/gnuhealth1in firefox, the following error exist:

```
----------------------------------------
Exception occurred during processing of request from ('::ffff:127.0.0.1', 57936, 0, 0)
Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 720, in _init_
    self.handle()
  File "/usr/lib/python3.9/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/usr/lib/python3.9/http/server.py", line 405, in handle_one_request
    if not self.parse_request():
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 577, in parse_request
    if not self.get_userinfo(user, password, self.command):
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 622, in get_userinfo
    Cache.clean(dbname)
AttributeError: type object 'MemoryCache' has no attribute 'clean'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.9/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.9/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.9/socketserver.py", line 722, in _init_
    self.finish()
  File "/home/feng/gnuhealth/tryton/server/trytond-6.0.20/trytond/modules/health_webdav3_server/protocol.py", line 561, in finish
    Cache.resets(dbname)
AttributeError: type object 'MemoryCache' has no attribute 'resets'
----------------------------------------

```





Feng Shu <tumashu>
Tue 14 Jun 2022 01:45:22 PM UTC, comment #2: 

Hey Luis,
I had to test accessing it in the browser and look at details with journalctl.
I'm running it installed by pip in venv and called from systemd using

User=gnuhealth
ExecStart=/opt/gnuhealth/venv/bin/gnuhealth-webdav-server -c /opt/gnuhealth/etc/trytond.conf -vv

Using "sudo journalctl -u gnuhealth_webdav" I see an OSError twice:
"OSError: Database '/opt/gnuhealth/var/lib/health.sqlite' doesn't exist!"

Then I add 'Environment="TRYTOND_CONFIG=/opt/gnuhealth/etc/trytond.conf"' to resolve it which is strange because it's already given by -c flag.

Afterwards I see "AttributeError: type object 'MemoryCache' has no attribute 'clean'" and same with 'resets' instead of 'clean'.

So I change "Cache.resets(dbname)" to "pass" and outcomment "Cache.clean(dbname)" in /opt/gnuhealth/venv/lib/python3.8/site-packages/trytond/modules/health_webdav3_server/protocol.py

Now I get "NameError: name 'os' is not defined" from the same protocol.py thus I add "import os".

Next one is KeyError: 'GNUHEALTH_VERSION' so I add
"Environment="GNUHEALTH_VERSION=4.0.3""
to the .service file and now it's running and accessible :)

Now when I reproduced it step by step it was quite strange that sometimes I had to access it to trigger an error and sometimes I had to restart more than one time to see the error. Everytime having an error it was "running" and listenning to the right port but not working. Of course I run "sudo systemctl daemon-reload" before "sudo systemctl restart gnuhealth_webdav" when changing the .service file.

To sum up I would still say:
- Add "import os" in health_webdav3_server/protocol.py. I don't see it in mercurial/health/tryton/health_webdav3_server/protocol.py
- Still in the same protocol.py line 560 "Cache.resets(dbname)" and line 621 "Cache.clean(dbname)" have to be removed or changed.

The complete .service file I have now when it's running:
[Unit]
Description=GNU Health WebDAV Server
After=syslog.target
Requires=gnuhealth.service

[Service]
User=gnuhealth
ExecStart=/opt/gnuhealth/venv/bin/gnuhealth-webdav-server -vv
Environment="TRYTOND_CONFIG=/opt/gnuhealth/etc/trytond.conf"
Environment="GNUHEALTH_VERSION=4.0.3"
Restart=always
KillSignal=SIGQUIT
Type=simple
StandardError=syslog
NotifyAccess=all

[Install]
WantedBy=multi-user.target


comment #1:

> Dear Gerald
>
> Thank you for reporting!
>
> I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.
>
> It seems to run OK on my box...
>
> lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
> 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
> 2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
> 2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080
>

Gerald Wiese <gerald_wiese>
Group Member
Tue 14 Jun 2022 12:40:09 PM UTC, comment #1: 

Dear Gerald

Thank you for reporting!

I can't reproduce it.. are you actually executing the webdav server from the "bin" dir (gnuhealth-webdav-server)? Notice the "os" package is there.

It seems to run OK on my box...

lfm@beastie:~/gnuhealth/tryton/server/modules/health_webdav3_server/bin $ ./gnuhealth-webdav-server -vv
2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server using /home/lfm/gnuhealth/tryton/server/config/trytond.conf as configuration file
2285198 140280141563712 [2022-06-14 12:35:16,322] INFO trytond.modules.health_webdav3_server.server initialising distributed objects services
2285198 140280141563712 [2022-06-14 12:35:16,357] INFO trytond.modules.health_webdav3_server.server starting WebDAV protocol on *:8080

Luis Falcon <meanmicio>
Group administrator
Thu 09 Jun 2022 12:26:25 PM UTC, original submission:  

Starting the WebDAV server I got two AttributeErrors because 'MemoryCache' got no attributes 'clean' and 'resets'. MemoryCache is defined in trytond/cache.py and in this case accessed from health_webdav3_server/protocol.py. Since trytond 5.2 those methods don't exist anymore.
Regarding those errors I tested both removing the lines "Cache.clean(dbname)" & "Cache.resets(dbname)" and changing them to "LOCAL.cache.clear()".
Afterwards I got errors because "import os" was missing in protocol.py.
Finally "os.environ['GNUHEALTH_VERSION']" was not defined in my case as I installed GNU Health using pip. For the moment I resolved this by defining GNUHEALTH_VERSION in the systemd service.

Gerald Wiese <gerald_wiese>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #53453:  protocol.py.diff added by gerald_wiese (479B - text/x-patch)
file #53454:  protocol.py added by gerald_wiese (22KiB - text/x-python)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by tumashu (Posted a comment)
  • -email is unavailable- added by meanmicio (Posted a comment)
  • -email is unavailable- added by gerald_wiese (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-01-20 gerald_wiese StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-07-27 gerald_wiese StatusNeed Info Ready For Test
    2022-07-21 tumashu Attached File- Added 截图_2022-07-21_17-53-06.png, #53456
        Attached File- Added 截图_2022-07-21_17-52-33.png, #53457
    2022-07-20 gerald_wiese ComponentNone Hospital Management
    2022-07-20 gerald_wiese Attached File- Added protocol.py.diff, #53453
        Attached File- Added protocol.py, #53454
    2022-06-14 meanmicio StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code