GithubHelp home page GithubHelp logo

Comments (22)

maxidev avatar maxidev commented on July 19, 2024 2

We've managed to temporary solve this issue by making some small changes on Python libraries.
This are the changes.

/usr/lib/python2.7/wsgiref/simple_server.py

Class ServerHandler

class ServerHandler(SimpleHandler):

    server_software = software_version

    def close(self):
        try:
            # if self.status is not defined, pass hardcoded status
            status = "200"
            if self.status:
               status = self.status.split(' ', 1)[0]
            self.request_handler.log_request(
                status, self.bytes_sent
            )
        finally:
            SimpleHandler.close(self)

/usr/lib/python2.7/wsgiref/handles.py

Class BaseHandler

method "finish_response"

def finish_response(self):
        try:
            if not self.result_is_file() or not self.sendfile():
                for data in self.result:
                    # self.write(data)
                    # convert data to str
                    self.write(str(data)) 
                self.finish_content()
        finally:
            self.close()

method "client_is_modern"

def client_is_modern(self):
        """True if client can accept status and headers"""
        # check if self.environ is defined
        if not self.environ:
            return False
        return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'

/cc @gidgreen

from multichain-explorer.

gidgreen avatar gidgreen commented on July 19, 2024 1

OK - thanks for the update. It fixed the search redirect problem we were seeing, but there's obviously a version/configuration issue here. We'll keep working on it.

from multichain-explorer.

gidgreen avatar gidgreen commented on July 19, 2024 1

Thanks, so seems very specific to Python 2.7.12/13. We'll look into it and let you know if we need any more info.

from multichain-explorer.

bitcartel avatar bitcartel commented on July 19, 2024

@ottodv What version of python are you running? 2.7.???

from multichain-explorer.

ottodv avatar ottodv commented on July 19, 2024

Python 2.7.12

from multichain-explorer.

bitcartel avatar bitcartel commented on July 19, 2024

This error only occurs on the search page?

from multichain-explorer.

ottodv avatar ottodv commented on July 19, 2024

Yes, that's the only situation in which I encounter this error.
BTW, I also did a new install from scratch on another VM, but using CentOS this time, to see if the error occurs there too.
The result is exactly the same error in the same situation (i.e. doing a search).
The Python version on that VM is 2.7.5

from multichain-explorer.

gidgreen avatar gidgreen commented on July 19, 2024

This should now be fixed in the latest version of the Explorer - if so please close the issue.

from multichain-explorer.

ottodv avatar ottodv commented on July 19, 2024

I installed the lastest version from github as you suggested. Search still doesn't work, but in addition to the previous error, I got an additional error message in the log (on Ubuntu, strangely not on CentOS). It doesn't look very helpful, but I post it here just in case it might be to you.

AttributeError: 'NoneType' object has no attribute 'split'
myheader': [], 'title': ['MultiChain Explorer', ' ', '0.8pre'], 'dotdot': '', 'params': {'q': ['100']}, 'env': {'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'LC_ALL': 'en_US.UTF-8', 'wsgi.multiprocess': False, 'SERVER_PORT': '80', 'HTTP_REFERER': 'http://<REMOVED URL>/chains', 'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x7f4ab654bbb0>, 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.12', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.multithread': True, 'SCRIPT_NAME': '', 'wsgi.input': <socket._fileobject object at 0x7f4ab60428d0>, 'REQUEST_METHOD': 'GET', 'LOGNAME': 'node', 'PATH_INFO': '/search', 'HOME': '/home/node', 'QUERY_STRING': 'q=100', 'PATH': '/usr/bin:/bin:/home/node/bin:/usr/local/bin', 'REMOTE_ADDR': '<REMOVED IP>', '_': '/usr/bin/python', 'wsgi.version': (1, 0), 'LANG': 'en_US.UTF-8', 'SHELL': '/bin/sh', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0', 'SERVER_NAME': 'explore.localdomain', 'GATEWAY_INTERFACE': 'CGI/1.1', 'SHLVL': '2', 'OLDPWD': '/home/node', 'HTTP_X_COOKIESOK': 'I explicitly accept all cookies', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8,nl;q=0.7,fr;q=0.5,et;q=0.3,de;q=0.2', 'wsgi.errors': <open file '<stderr>', mode 'w' at 0x7f4ab78f41e0>, 'wsgi.url_scheme': 'http', 'wsgi.run_once': False, 'PWD': '/home/node/multichain-explorer', 'CONTENT_TYPE': 'text/plain', 'CONTENT_LENGTH': '', 'HTTP_HOST': '<REMOVED IP>', 'HTTP_UPGRADE_INSECURE_REQUESTS': '1', 'REMOTE_HOST': '', 'HTTP_ACCEPT_ENCODING': 'gzip, deflate'}}
----------------------------------------
Exception happened during processing of request from ('<REMOVED IP>', 58796)
----------------------------------------
{'status': '200 OK', 'body': [], 'template': u'\n<!DOCTYPE html>\n<html lang="en">\n<head>\n    <meta charset="utf-8">\n    <meta http-equiv="X-UA-Compatible" content="IE=edge">\n    <meta name="viewport" content="width=device-width, initial-scale=1">\n    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->\n\n    <title>%(title)s</title>\n\n    <!-- Bootstrap and Theme -->\n    <link href="%(dotdot)s%(STATIC_PATH)scss/bootstrap.min.css" rel="stylesheet">\n    <link href="%(dotdot)s%(STATIC_PATH)scss/bootstrap-theme.min.css" rel="stylesheet">\n\n    <!-- jQuery (necessary for Bootstrap\'s JavaScript plugins) -->\n    <script src="%(dotdot)s%(STATIC_PATH)sjs/jquery-1.11.3.min.js"></script>\n    <!-- Include all compiled plugins (below), or include individual files as needed -->\n    <script src="%(dotdot)s%(STATIC_PATH)sjs/bootstrap.min.js"></script>\n\n    %(myheader)s\n</head>\n<body>\n    <div class="container">\n\t<table><td>\n\t<a title="Back to home" href="%(dotdot)s%(HOMEPAGE)s"><img src="%(dotdot)s%(STATIC_PATH)slogo32.png" alt="MultiChain logo" /></a>\n\t</td><td style="padding-left: 10px;" valign="middle">\n\t<h1>%(h1)s<h1>\n\t</td></table>\n    %(body)s\n    <!--<p><a href="%(dotdot)sq">API</a> (machine-readable pages)</p>-->\n    <br><br>\n    <p style="font-size: smaller">\n        <span style="font-style: italic">\n            Powered by <a href="%(ABE_URL)s">%(APPNAME)s</a>\n        </span>\n        %(download)s\n    </p>\n    </div>\n</body>\n</html>\n', 'chain': None, 'start_response': <bound method ServerHandler.start_response of <wsgiref.simple_server.ServerHandler instance at 0x7f4ab5f56710>>, 'content_type': 'text/html; charset=utf-8', 'myheader': [], 'title': ['MultiChain Explorer', ' ', '0.8pre'], 'dotdot': '', 'params': {'q': ['100']}, 'env': {'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'LC_ALL': 'en_US.UTF-8', 'wsgi.multiprocess': False, 'SERVER_PORT': '80', 'HTTP_REFERER': 'http://<REMOVED URL>/chains', 'wsgi.file_wrapper': <class wsgiref.util.FileWrapper at 0x7f4ab654bbb0>, 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.7.12', 'SERVER_PROTOCOL': 'HTTP/1.1', 'wsgi.multithread': True, 'SCRIPT_NAME': '', 'wsgi.input': <socket._fileobject object at 0x7f4ab60428d0>, 'REQUEST_METHOD': '<REMOVED IP> - - [29/Mar/2017 18:13:32] "GET /search?q=100 HTTP/1.1" 301 0

from multichain-explorer.

gidgreen avatar gidgreen commented on July 19, 2024

That's an error we should have fixed - did you rerun the python setup.py command from the README file?

from multichain-explorer.

ottodv avatar ottodv commented on July 19, 2024

Did now (python setup.py install), but still no dice. Even restarted the VMs. I am now back to seeing only the error I quoted in my opening post, on both the Ubuntu and CentOS severs.

from multichain-explorer.

maxidev avatar maxidev commented on July 19, 2024

Same error here, search still does not work.

from multichain-explorer.

reiven avatar reiven commented on July 19, 2024

ping

from multichain-explorer.

gidgreen avatar gidgreen commented on July 19, 2024

If you're seeing this problem please post your Python version.

from multichain-explorer.

reiven avatar reiven commented on July 19, 2024

I have the same error described by @ottodv (self.status.split(' ',1)[0], self.bytes_sent)

$ python --version
Python 2.7.13

Update: trying to run with python-3.5 i got this error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
   File "/usr/local/lib/python3.5/runpy.py", line 153, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap_external>", line 775, in get_code
  File "<frozen importlib._bootstrap_external>", line 735, in source_to_code
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/srv/multichain-explorer/Mce/abe.py", line 1206
    print "Exception:", e
                     ^
SyntaxError: Missing parentheses in call to 'print'

from multichain-explorer.

maxidev avatar maxidev commented on July 19, 2024

python --version
Python 2.7.12

from multichain-explorer.

maxidev avatar maxidev commented on July 19, 2024

Count me in if we have to test something on my box, I can post results, versions, etc.

from multichain-explorer.

maxidev avatar maxidev commented on July 19, 2024

What version do you recommend? I will try to manually change Python version until we can fix it.

UPDATE: my traceback

Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_noblock
    self.process_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
    self.handle()
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 131, in handle
    handler.run(self.server.get_app())
  File "/usr/lib/python2.7/wsgiref/handlers.py", line 92, in run
    self.close()
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 33, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

from multichain-explorer.

ottodv avatar ottodv commented on July 19, 2024

I also tried it on CentOS with Python version 2.7.5. Same Error. See my earlier comment from March 29.

from multichain-explorer.

reiven avatar reiven commented on July 19, 2024

@maxidev maybe you can switch the fix to a PR?

from multichain-explorer.

maxidev avatar maxidev commented on July 19, 2024

@reiven I can't because this was done on Python libraries instead of Multichain-explorer code.

from multichain-explorer.

ssls18years avatar ssls18years commented on July 19, 2024

i found same errors. i try search by address, txid, blocknumber...,but only blocknumber is success, others will cause page crash.

i installed latest explore and 100009 multichain

after i modify simple_server.py & handles.py, search works correctly.

But, this is finally solution?

from multichain-explorer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.