[SOLVED] Network error. Error #system:13 with CentOS image


#1

Hello I have a weird problem and I would like some help please:

I am using your CentOS image on VirtualBox on Windows 8 (NAT) and I am running this simple script. It is a wsgi script that calls scidb.querySciDB

#scidb.py
import os
import sys
import time
import subprocess      

sys.path.append('/var/www/html/stra')

def querySciDB(cmd):
    proc = subprocess.Popen(["/opt/scidb/13.3/bin/iquery","-o", "csv", "-q", cmd], stdout = subprocess.PIPE)
    out,err = proc.communicate()
    lines = out.split("\n")
    rows = lines[1:-1]
    return rows

[code]
#file.wsgi
import json
import Image
import sys
sys.path.append("/var/www/html/stra")
import scidb
def application(environ, start_response):
start_response(‘200 OK’, [(‘Content-Type’, ‘text/html’)])
bitmap = scidb.querySciDB(“SELECT * FROM subarray(Michalis,0,0,1024,1024)”)
return bitmap

if name == ‘main’:
bitmap = scidb.querySciDB(“SELECT * FROM subarray(Michalis,0,0,1024,1024)”)
print bitmap[/code]

And I am getting this error in /var/log/httpd/error_log only when calling the script through browser (GET/POST).

/opt/scidb/13.3/bin/iquery SystemException in file: src/network/BaseConnection.cpp function: connect line: 262 Error id: scidb::SCIDB_SE_NETWORK::SCIDB_LE_CONNECTION_ERROR Error description: Network error. Error #system:13 when connecting to localhost:1239.

If I run the script with “python file.wsgi” everything works fine.
It is not an wsgi/browser/iquery/query problem …

Thanks in advance


#2

Anyone can at least tell me what type of problem is #13 and how could it be caused when calling iquery through wsgi and not through python script?


#3

Zifnab,

I’m sorry I am not familiar with “wsgi” but it looks like you’re using Python here, and the scidb-py module. The syntax for importing from the module does not match the documentation, see:

github.com/jakevdp/SciDB-py

for more information.

But it is possible that the problem is in our VM–Our CentOS virtual machine image has not been updated since March and does not include the latest software–this may be part of the issue you encountered.

Our Amazon EC2 AMI includes the latest software–that represents the best test platform at the moment.

I’ll work on updating the virtual machine images and send a post here when they are ready.

–Bryan


#4

Thank you. I am not using SciDB-py - this scidb.py file is just the file I have quoted …
I am using WSGI (and specifically mod_wsgi). WSGI is one of the two ways to use python for web services… code.google.com/p/modwsgi/

Could it be that you changed the iquery permissions when it is being called by subprocess.Popen somehow (instead of it being called through command line)? I have used the very same code
in older versions of SciDB (12.10) on Ubuntu and didn’t have any problems…

I really cannot trust Amazon EC2 for running experiments having problems in the past - let alone that I am still on development phase.

Edit:

I run this from python command line

import subprocess 
proc = subprocess.Popen(["/opt/scidb/13.3/bin/iquery","-o", "csv", "-q", "SELECT * FROM subarray(Michalis,0,0,1024,1024)"], stdout = subprocess.PIPE)
out,err = proc.communicate()
lines = out.split("\n")
print lines

and worked fine so the problem has to be that wsgi is configured incorrectly…


#5

So it is not wsgi I am just using pure python visiting ‘localhost/stra/test.py’ from the browser

#test.py import scidb def index(): bitmap = scidb.querySciDB("SELECT * FROM subarray(Michalis,0,0,1024,1024)") return str(bitmap)

and this string is printed in browser:


I checked if the firewall was the problem - no success

I tried this way

import scidbapi as scidb database = scidb.connect("localhost", 1239)

And I am getting the same error in apache error_log

Also tried through php

the same error in error_log…


I changed apache User to scidb - and it didn’t work either


It seems to me that SciDB is configured in a way that is not remotely accessible for that configuration I have in the image - could that be the case? I didn’t find any configuration option to change that :confused:


#6

Problem Solved! The problem was selinux was running on “enforcing” mode - If you disable it, it works fine through browser calling the script :smile: