orioledb / orioledb

OrioleDB – building a modern cloud-native storage engine (... and solving some PostgreSQL wicked problems)  🇺🇦

Home Page:https://orioledb.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test stuck: s3_queue_wait_for_location

Tanyaevm opened this issue · comments

Tested on main
Commit 35dd610

t/example_test.py:

import json
import logging
import os
import time
from threading import Thread
from typing import Optional

import boto3
from botocore import UNSIGNED
from botocore.config import Config
from moto.core import set_initial_no_auth_action_count
from moto.server import DomainDispatcherApplication, create_backend_app
from testgres.enums import NodeStatus
from werkzeug.serving import (BaseWSGIServer, make_ssl_devcert,
                              make_server)

from .base_test import BaseTest

log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

class S3Test(BaseTest):
	bucket_name = "test-bucket"
	host="localhost"
	port=5000
	iam_port=5001
	dir_path = os.path.dirname(os.path.realpath(__file__))
	user="ORDB_USER"
	region="us-east-1"

	@classmethod
	@set_initial_no_auth_action_count(4)
	def setUpClass(cls):
		cls.ssl_key = make_ssl_devcert('/tmp/ordb_test_key', cn=cls.host)
		cls.s3_server = MotoServerSSL(ssl_context=cls.ssl_key)
		cls.s3_server.start()
		cls.iam_server = MotoServerSSL(port=cls.iam_port, service='iam',
									   ssl_context=cls.ssl_key)
		cls.iam_server.start()

		iam_config = Config(signature_version = UNSIGNED)

		iam = boto3.client('iam', config=iam_config,
						   endpoint_url=f"https://{cls.host}:{cls.iam_port}",
						   verify=cls.ssl_key[0])
		iam.create_user(UserName=cls.user)
		policy_document = {
			"Version": "2012-10-17",
			"Statement": {"Effect": "Allow", "Action": "*", "Resource": "*"}
		}
		policy = iam.create_policy(PolicyName="ORDB_POLICY",
				 				   PolicyDocument=json.dumps(policy_document))
		policy_arn = policy["Policy"]["Arn"]
		iam.attach_user_policy(UserName=cls.user, PolicyArn=policy_arn)
		response = iam.create_access_key(UserName=cls.user)
		cls.access_key_id = response["AccessKey"]["AccessKeyId"]
		cls.secret_access_key = response["AccessKey"]["SecretAccessKey"]

	@classmethod
	def tearDownClass(cls):
		cls.s3_server.stop()
		cls.iam_server.stop()

	def setUp(self):
		super().setUp()

		session = boto3.Session(
			aws_access_key_id=self.access_key_id,
			aws_secret_access_key=self.secret_access_key,
			region_name=self.region
		)
		host_port = f"https://{self.host}:{self.port}"
		self.client = session.client("s3", endpoint_url=host_port,
									 verify=self.ssl_key[0])
		try:
			self.client.head_bucket(Bucket=self.bucket_name)
		except:
			self.client.create_bucket(Bucket=self.bucket_name)

	def tearDown(self):
		super().tearDown()
		objects = self.client.list_objects(Bucket=self.bucket_name)
		objects = objects.get("Contents", [])
		while objects != []:
			objects = list({"Key": x["Key"]} for x in objects)
			self.client.delete_objects(Bucket=self.bucket_name,
									   Delete={"Objects":objects})
			objects = self.client.list_objects(Bucket=self.bucket_name)
			objects = objects.get("Contents", [])

		self.client.delete_bucket(Bucket=self.bucket_name)
		self.client.close()
	
	
	def test_1(self):
		
		node = self.node
		node.append_conf('postgresql.conf', f"""
			orioledb.s3_mode = true
			orioledb.s3_host = '{self.host}:{self.port}/{self.bucket_name}'
			orioledb.s3_region = '{self.region}'
			orioledb.s3_accesskey = '{self.access_key_id}'
			orioledb.s3_secretkey = '{self.secret_access_key}'
			orioledb.s3_cainfo = '{self.ssl_key[0]}'
			orioledb.s3_num_workers = 1
		""")
		node.start()
		node.safe_psql("CREATE EXTENSION IF NOT EXISTS orioledb;")
		
		node.safe_psql("""
		
			CREATE TABLE o_test_1(
				val_1 text NOT NULL COLLATE "C",
				PRIMARY KEY (val_1)
			)USING orioledb;
			
			ALTER TABLE o_test_1 ALTER val_1 TYPE text COLLATE "POSIX";

		""")

		node.stop(['-m', 'immediate'])

		node.start()	

class MotoServerSSL:
	def __init__(self, host: str = "localhost", port: int = 5000,
				 service: Optional[str] = None, ssl_context=None):
		self._host = host
		self._port = port
		self._service = service
		self._thread: Optional[Thread] = None
		self._server: Optional[BaseWSGIServer] = None
		self._server_ready = False
		self._ssl_context = ssl_context

	def _server_entry(self) -> None:
		app = DomainDispatcherApplication(create_backend_app, self._service)

		self._server = make_server(self._host, self._port, app, False,
								   ssl_context=self._ssl_context,
								   passthrough_errors=True)
		self._server_ready = True
		self._server.serve_forever()

	def start(self) -> None:
		self._thread = Thread(target=self._server_entry, daemon=True)
		self._thread.start()
		while not self._server_ready:
			time.sleep(0.1)

	def stop(self) -> None:
		self._server_ready = False
		if self._server:
			self._server.shutdown()

		self._thread.join() 

Stuck stack

0x00007fd2c0d4945a in epoll_wait (epfd=9, events=0x5600bb38dc78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
#0  0x00007fd2c0d4945a in epoll_wait (epfd=9, events=0x5600bb38dc78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00005600b943743d in WaitEventSetWaitBlock (nevents=1, occurred_events=0x7ffc91d3ddb0, cur_timeout=-1, set=0x5600bb38dc18) at latch.c:1489
#2  WaitEventSetWait (set=0x5600bb38dc18, timeout=-1, occurred_events=0x7ffc91d3ddb0, nevents=1, wait_event_info=<optimized out>) at latch.c:1435
#3  0x00005600b9437858 in WaitLatch (latch=<optimized out>, wakeEvents=wakeEvents@entry=33, timeout=timeout@entry=-1, wait_event_info=wait_event_info@entry=134217758) at latch.c:497
#4  0x00005600b9445abf in ConditionVariableTimedSleep (wait_event_info=134217758, timeout=-1, cv=0x7fd2be718ea8) at condition_variable.c:163
#5  ConditionVariableTimedSleep (cv=0x7fd2be718ea8, timeout=-1, wait_event_info=134217758) at condition_variable.c:112
#6  0x00007fd2c03d4e86 in s3_queue_wait_for_location (location=0) at src/s3/queue.c:341
#7  0x00007fd2c03d65e9 in s3_load_file_part (chkpNum=chkpNum@entry=0, datoid=datoid@entry=5, relnode=relnode@entry=16453, segNum=segNum@entry=0, partNum=partNum@entry=0) at src/s3/worker.c:451
#8  0x00007fd2c03d3f28 in s3_header_lock_part (tag=..., index=index@entry=0) at src/s3/headers.c:658
#9  0x00007fd2c0384aed in btree_smgr_write (desc=desc@entry=0x5600bb3f1b78, buffer=buffer@entry=0x7fd2afb8f050 "", chkpNum=0, amount=amount@entry=8192, offset=0) at src/btree/io.c:499
#10 0x00007fd2c0384ea7 in write_page_to_disk (desc=desc@entry=0x5600bb3f1b78, extent=extent@entry=0x7ffc91d3e018, page=page@entry=0x7fd2afb8f050 "", page_size=8192) at src/btree/io.c:1069
#11 0x00007fd2c0386af8 in perform_page_io_build (desc=desc@entry=0x5600bb3f1b78, img=img@entry=0x7fd2afb8f050 "", extent=extent@entry=0x7ffc91d3e018, metaPage=metaPage@entry=0x7ffc91d3e030) at src/btree/io.c:1668
#12 0x00007fd2c037cafe in btree_write_index_data (desc=desc@entry=0x5600bb3f1b78, tupdesc=<optimized out>, sortstate=<optimized out>, ctid=<optimized out>, file_header=<optimized out>) at src/btree/build.c:420
#13 0x00007fd2c03a7452 in rebuild_indices (old_o_table=old_o_table@entry=0x5600bb4ae6b0, old_descr=old_descr@entry=0x5600bb3ee090, o_table=o_table@entry=0x5600bb506540, descr=descr@entry=0x5600bb3ee030) at src/catalog/indices.c:1477
#14 0x00007fd2c03a7919 in drop_primary_index (o_table=0x5600bb506540, rel=0x5600bb3ee090) at src/catalog/indices.c:1568
#15 o_index_drop (tbl=tbl@entry=0x7fd2afc8f550, ix_num=ix_num@entry=0) at src/catalog/indices.c:1615
#16 0x00007fd2c03a3a4e in orioledb_object_access_hook (access=OAT_DROP, classId=1259, objectId=16444, subId=0, arg=0x7ffc91d3e5b4) at src/catalog/ddl.c:1468
#17 0x00005600b91e8baa in RunObjectDropHook (classId=<optimized out>, objectId=<optimized out>, subId=<optimized out>, dropflags=dropflags@entry=1) at objectaccess.c:65
#18 0x00005600b91da75b in deleteOneObject (flags=1, depRel=0x7ffc91d3e800, object=0x5600bb505ae8) at dependency.c:1329
#19 deleteObjectsInList (targetObjects=0x5600bb505e18, depRel=0x7ffc91d3e800, flags=1) at dependency.c:308
#20 0x00005600b91dae58 in performMultipleDeletions (objects=objects@entry=0x5600bb4cf2d0, behavior=behavior@entry=DROP_RESTRICT, flags=flags@entry=1) at dependency.c:471
#21 0x00005600b92a3c8e in ATPostAlterTypeCleanup (lockmode=8, tab=0x5600bb409268, wqueue=0x7ffc91d3e8b8) at tablecmds.c:13339
#22 ATRewriteCatalogs (context=0x7ffc91d3ea70, lockmode=8, wqueue=0x7ffc91d3e8b8) at tablecmds.c:4892
#23 ATController (parsetree=0x5600bb393d28, rel=<optimized out>, cmds=<optimized out>, recurse=<optimized out>, lockmode=8, context=0x7ffc91d3ea70) at tablecmds.c:4459
#24 0x00005600b94684d9 in ProcessUtilitySlow (pstate=0x5600bb409150, pstmt=0x5600bb394020, queryString=0x5600bb3926c0 "\n\t\t\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tf1 text NOT NULL COLLATE \"C\",\n\t\t\t\tPRIMARY KEY (f1)\n\t\t\t)USING orioledb;\n\t\t\t\n\t\t\tALTER TABLE o_test_1 ALTER f1 TYPE text COLLATE \"POSIX\";\n\n\t\t", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, qc=0x7ffc91d3f0d0, dest=<optimized out>) at utility.c:1325
#25 0x00005600b9466a61 in standard_ProcessUtility (pstmt=pstmt@entry=0x5600bb394020, queryString=queryString@entry=0x5600bb3926c0 "\n\t\t\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tf1 text NOT NULL COLLATE \"C\",\n\t\t\t\tPRIMARY KEY (f1)\n\t\t\t)USING orioledb;\n\t\t\t\n\t\t\tALTER TABLE o_test_1 ALTER f1 TYPE text COLLATE \"POSIX\";\n\n\t\t", readOnlyTree=<optimized out>, context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0, dest=0x5600bb394110, qc=0x7ffc91d3f0d0) at utility.c:1074
#26 0x00007fd2c03a1b6d in orioledb_utility_command (pstmt=0x5600bb394020, queryString=0x5600bb3926c0 "\n\t\t\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tf1 text NOT NULL COLLATE \"C\",\n\t\t\t\tPRIMARY KEY (f1)\n\t\t\t)USING orioledb;\n\t\t\t\n\t\t\tALTER TABLE o_test_1 ALTER f1 TYPE text COLLATE \"POSIX\";\n\n\t\t", readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, env=0x0, dest=0x5600bb394110, qc=0x7ffc91d3f0d0) at src/catalog/ddl.c:1002
#27 0x00005600b946527f in PortalRunUtility (portal=portal@entry=0x5600bb450c50, pstmt=pstmt@entry=0x5600bb394020, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=0x5600bb394110, qc=0x7ffc91d3f0d0) at pquery.c:1158
#28 0x00005600b94653d4 in PortalRunMulti (portal=portal@entry=0x5600bb450c50, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x5600bb394110, altdest=altdest@entry=0x5600bb394110, qc=qc@entry=0x7ffc91d3f0d0) at pquery.c:1315
#29 0x00005600b9465a61 in PortalRun (portal=portal@entry=0x5600bb450c50, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x5600bb394110, altdest=altdest@entry=0x5600bb394110, qc=0x7ffc91d3f0d0) at pquery.c:791
#30 0x00005600b9461652 in exec_simple_query (query_string=0x5600bb3926c0 "\n\t\t\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tf1 text NOT NULL COLLATE \"C\",\n\t\t\t\tPRIMARY KEY (f1)\n\t\t\t)USING orioledb;\n\t\t\t\n\t\t\tALTER TABLE o_test_1 ALTER f1 TYPE text COLLATE \"POSIX\";\n\n\t\t") at postgres.c:1250
#31 0x00005600b9463432 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#32 0x00005600b93cf61a in BackendRun (port=<optimized out>, port=<optimized out>) at postmaster.c:4531
#33 BackendStartup (port=<optimized out>) at postmaster.c:4259
#34 ServerLoop () at postmaster.c:1816
#35 0x00005600b93d078b in PostmasterMain (argc=<optimized out>, argv=0x5600bb38cb80) at postmaster.c:1488
#36 0x00005600b90efb60 in main (argc=3, argv=0x5600bb38cb80) at main.c:202
[Inferior 1 (process 1109021) detached]

Run as:

make USE_PGXS=1 testgrescheck_part_1 TESTGRESCHECKS_PART_1="t.s3_test.S3Test.test_1"

Where:

  • t - folder with python tests
  • s3_test - test file name
  • S3Test - test class name
  • test_1 - test name

Tested on main
Commit 35dd610

t/example_test.py:

import json
import logging
import os
import time
from threading import Thread
from typing import Optional

import boto3
from botocore import UNSIGNED
from botocore.config import Config
from moto.core import set_initial_no_auth_action_count
from moto.server import DomainDispatcherApplication, create_backend_app
from testgres.enums import NodeStatus
from werkzeug.serving import (BaseWSGIServer, make_ssl_devcert,
                              make_server)

from .base_test import BaseTest

log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

class S3Test(BaseTest):
	bucket_name = "test-bucket"
	host="localhost"
	port=5000
	iam_port=5001
	dir_path = os.path.dirname(os.path.realpath(__file__))
	user="ORDB_USER"
	region="us-east-1"

	@classmethod
	@set_initial_no_auth_action_count(4)
	def setUpClass(cls):
		cls.ssl_key = make_ssl_devcert('/tmp/ordb_test_key', cn=cls.host)
		cls.s3_server = MotoServerSSL(ssl_context=cls.ssl_key)
		cls.s3_server.start()
		cls.iam_server = MotoServerSSL(port=cls.iam_port, service='iam',
									   ssl_context=cls.ssl_key)
		cls.iam_server.start()

		iam_config = Config(signature_version = UNSIGNED)

		iam = boto3.client('iam', config=iam_config,
						   endpoint_url=f"https://{cls.host}:{cls.iam_port}",
						   verify=cls.ssl_key[0])
		iam.create_user(UserName=cls.user)
		policy_document = {
			"Version": "2012-10-17",
			"Statement": {"Effect": "Allow", "Action": "*", "Resource": "*"}
		}
		policy = iam.create_policy(PolicyName="ORDB_POLICY",
				 				   PolicyDocument=json.dumps(policy_document))
		policy_arn = policy["Policy"]["Arn"]
		iam.attach_user_policy(UserName=cls.user, PolicyArn=policy_arn)
		response = iam.create_access_key(UserName=cls.user)
		cls.access_key_id = response["AccessKey"]["AccessKeyId"]
		cls.secret_access_key = response["AccessKey"]["SecretAccessKey"]

	@classmethod
	def tearDownClass(cls):
		cls.s3_server.stop()
		cls.iam_server.stop()

	def setUp(self):
		super().setUp()

		session = boto3.Session(
			aws_access_key_id=self.access_key_id,
			aws_secret_access_key=self.secret_access_key,
			region_name=self.region
		)
		host_port = f"https://{self.host}:{self.port}"
		self.client = session.client("s3", endpoint_url=host_port,
									 verify=self.ssl_key[0])
		try:
			self.client.head_bucket(Bucket=self.bucket_name)
		except:
			self.client.create_bucket(Bucket=self.bucket_name)

	def tearDown(self):
		super().tearDown()
		objects = self.client.list_objects(Bucket=self.bucket_name)
		objects = objects.get("Contents", [])
		while objects != []:
			objects = list({"Key": x["Key"]} for x in objects)
			self.client.delete_objects(Bucket=self.bucket_name,
									   Delete={"Objects":objects})
			objects = self.client.list_objects(Bucket=self.bucket_name)
			objects = objects.get("Contents", [])

		self.client.delete_bucket(Bucket=self.bucket_name)
		self.client.close()
	
	
	def test_1(self):
		
		node = self.node
		node.append_conf('postgresql.conf', f"""
			orioledb.s3_mode = true
			orioledb.s3_host = '{self.host}:{self.port}/{self.bucket_name}'
			orioledb.s3_region = '{self.region}'
			orioledb.s3_accesskey = '{self.access_key_id}'
			orioledb.s3_secretkey = '{self.secret_access_key}'
			orioledb.s3_cainfo = '{self.ssl_key[0]}'
			orioledb.s3_num_workers = 1
		""")
		node.start()
		node.safe_psql("CREATE EXTENSION IF NOT EXISTS orioledb;")
		
		node.safe_psql("""
		
			CREATE TABLE o_test_1(
				val_1 int PRIMARY KEY
			)USING orioledb;

			ALTER TABLE o_test_1 
				DROP CONSTRAINT o_test_1_pkey;
			
		""")

		node.stop(['-m', 'immediate'])

		node.start()	

class MotoServerSSL:
	def __init__(self, host: str = "localhost", port: int = 5000,
				 service: Optional[str] = None, ssl_context=None):
		self._host = host
		self._port = port
		self._service = service
		self._thread: Optional[Thread] = None
		self._server: Optional[BaseWSGIServer] = None
		self._server_ready = False
		self._ssl_context = ssl_context

	def _server_entry(self) -> None:
		app = DomainDispatcherApplication(create_backend_app, self._service)

		self._server = make_server(self._host, self._port, app, False,
								   ssl_context=self._ssl_context,
								   passthrough_errors=True)
		self._server_ready = True
		self._server.serve_forever()

	def start(self) -> None:
		self._thread = Thread(target=self._server_entry, daemon=True)
		self._thread.start()
		while not self._server_ready:
			time.sleep(0.1)

	def stop(self) -> None:
		self._server_ready = False
		if self._server:
			self._server.shutdown()

		self._thread.join() 

Stuck stack

0x00007f5c8c86045a in epoll_wait (epfd=9, events=0x5568f4c6fc78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
#0  0x00007f5c8c86045a in epoll_wait (epfd=9, events=0x5568f4c6fc78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00005568f27e343d in WaitEventSetWaitBlock (nevents=1, occurred_events=0x7ffdb2a972d0, cur_timeout=-1, set=0x5568f4c6fc18) at latch.c:1489
#2  WaitEventSetWait (set=0x5568f4c6fc18, timeout=-1, occurred_events=0x7ffdb2a972d0, nevents=1, wait_event_info=<optimized out>) at latch.c:1435
#3  0x00005568f27e3858 in WaitLatch (latch=<optimized out>, wakeEvents=wakeEvents@entry=33, timeout=timeout@entry=-1, wait_event_info=wait_event_info@entry=134217758) at latch.c:497
#4  0x00005568f27f1abf in ConditionVariableTimedSleep (wait_event_info=134217758, timeout=-1, cv=0x7f5c8a22fea8) at condition_variable.c:163
#5  ConditionVariableTimedSleep (cv=0x7f5c8a22fea8, timeout=-1, wait_event_info=134217758) at condition_variable.c:112
#6  0x00007f5c8beebe86 in s3_queue_wait_for_location (location=0) at src/s3/queue.c:341
#7  0x00007f5c8beed5e9 in s3_load_file_part (chkpNum=chkpNum@entry=0, datoid=datoid@entry=5, relnode=relnode@entry=16453, segNum=segNum@entry=0, partNum=partNum@entry=0) at src/s3/worker.c:451
#8  0x00007f5c8beeaf28 in s3_header_lock_part (tag=..., index=index@entry=0) at src/s3/headers.c:658
#9  0x00007f5c8be9baed in btree_smgr_write (desc=desc@entry=0x5568f4cd3b78, buffer=buffer@entry=0x7f5c7b727050 "", chkpNum=0, amount=amount@entry=8192, offset=0) at src/btree/io.c:499
#10 0x00007f5c8be9bea7 in write_page_to_disk (desc=desc@entry=0x5568f4cd3b78, extent=extent@entry=0x7ffdb2a97538, page=page@entry=0x7f5c7b727050 "", page_size=8192) at src/btree/io.c:1069
#11 0x00007f5c8be9daf8 in perform_page_io_build (desc=desc@entry=0x5568f4cd3b78, img=img@entry=0x7f5c7b727050 "", extent=extent@entry=0x7ffdb2a97538, metaPage=metaPage@entry=0x7ffdb2a97550) at src/btree/io.c:1668
#12 0x00007f5c8be93afe in btree_write_index_data (desc=desc@entry=0x5568f4cd3b78, tupdesc=<optimized out>, sortstate=<optimized out>, ctid=<optimized out>, file_header=<optimized out>) at src/btree/build.c:420
#13 0x00007f5c8bebe452 in rebuild_indices (old_o_table=old_o_table@entry=0x5568f4d90690, old_descr=old_descr@entry=0x5568f4cd0090, o_table=o_table@entry=0x5568f4ceb560, descr=descr@entry=0x5568f4cd0030) at src/catalog/indices.c:1477
#14 0x00007f5c8bebe919 in drop_primary_index (o_table=0x5568f4ceb560, rel=0x5568f4cd0090) at src/catalog/indices.c:1568
#15 o_index_drop (tbl=tbl@entry=0x7f5c7b7a5be8, ix_num=ix_num@entry=0) at src/catalog/indices.c:1615
#16 0x00007f5c8bebaa4e in orioledb_object_access_hook (access=OAT_DROP, classId=1259, objectId=16444, subId=0, arg=0x7ffdb2a97ad4) at src/catalog/ddl.c:1468
#17 0x00005568f2594baa in RunObjectDropHook (classId=<optimized out>, objectId=<optimized out>, subId=<optimized out>, dropflags=dropflags@entry=0) at objectaccess.c:65
#18 0x00005568f258675b in deleteOneObject (flags=0, depRel=0x7ffdb2a97d20, object=0x5568f4cebaa0) at dependency.c:1329
#19 deleteObjectsInList (targetObjects=0x5568f4ceba68, depRel=0x7ffdb2a97d20, flags=0) at dependency.c:308
#20 0x00005568f2586d41 in performDeletion (object=object@entry=0x7ffdb2a97da4, behavior=behavior@entry=DROP_RESTRICT, flags=flags@entry=0) at dependency.c:395
#21 0x00005568f26489bc in ATExecDropConstraint (rel=0x7f5c7b7a5be8, constrName=0x5568f4cca7f8 "o_test_1_pkey", behavior=DROP_RESTRICT, recurse=true, recursing=<optimized out>, missing_ok=<optimized out>, lockmode=8) at tablecmds.c:12026
#22 0x00005568f264f282 in ATExecCmd (wqueue=0x7ffdb2a980c8, tab=0x5568f4ceb268, cmd=<optimized out>, lockmode=8, cur_pass=<optimized out>, context=0x7ffdb2a98280) at tablecmds.c:5080
#23 0x00005568f264fadb in ATRewriteCatalogs (context=0x7ffdb2a98280, lockmode=8, wqueue=0x7ffdb2a980c8) at ../../../src/include/nodes/nodes.h:610
#24 ATController (parsetree=0x5568f4c75840, rel=<optimized out>, cmds=<optimized out>, recurse=<optimized out>, lockmode=8, context=0x7ffdb2a98280) at tablecmds.c:4459
#25 0x00005568f28144d9 in ProcessUtilitySlow (pstate=0x5568f4ceb150, pstmt=0x5568f4c75b38, queryString=0x5568f4c746c0 "\n \n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 int PRIMARY KEY\n\t\t\t)USING orioledb;\n\n\t\t\tALTER TABLE o_test_1 \n\t\t\t\tDROP CONSTRAINT o_test_1_pkey;\n\n\t\t", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, qc=0x7ffdb2a988e0, dest=<optimized out>) at utility.c:1325
#26 0x00005568f2812a61 in standard_ProcessUtility (pstmt=pstmt@entry=0x5568f4c75b38, queryString=queryString@entry=0x5568f4c746c0 "\n \n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 int PRIMARY KEY\n\t\t\t)USING orioledb;\n\n\t\t\tALTER TABLE o_test_1 \n\t\t\t\tDROP CONSTRAINT o_test_1_pkey;\n\n\t\t", readOnlyTree=<optimized out>, context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0, dest=0x5568f4c75c28, qc=0x7ffdb2a988e0) at utility.c:1074
#27 0x00007f5c8beb8b6d in orioledb_utility_command (pstmt=0x5568f4c75b38, queryString=0x5568f4c746c0 "\n \n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 int PRIMARY KEY\n\t\t\t)USING orioledb;\n\n\t\t\tALTER TABLE o_test_1 \n\t\t\t\tDROP CONSTRAINT o_test_1_pkey;\n\n\t\t", readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, env=0x0, dest=0x5568f4c75c28, qc=0x7ffdb2a988e0) at src/catalog/ddl.c:1002
#28 0x00005568f281127f in PortalRunUtility (portal=portal@entry=0x5568f4d32c50, pstmt=pstmt@entry=0x5568f4c75b38, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=0x5568f4c75c28, qc=0x7ffdb2a988e0) at pquery.c:1158
#29 0x00005568f28113d4 in PortalRunMulti (portal=portal@entry=0x5568f4d32c50, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x5568f4c75c28, altdest=altdest@entry=0x5568f4c75c28, qc=qc@entry=0x7ffdb2a988e0) at pquery.c:1315
#30 0x00005568f2811a61 in PortalRun (portal=portal@entry=0x5568f4d32c50, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x5568f4c75c28, altdest=altdest@entry=0x5568f4c75c28, qc=0x7ffdb2a988e0) at pquery.c:791
#31 0x00005568f280d652 in exec_simple_query (query_string=0x5568f4c746c0 "\n \n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 int PRIMARY KEY\n\t\t\t)USING orioledb;\n\n\t\t\tALTER TABLE o_test_1 \n\t\t\t\tDROP CONSTRAINT o_test_1_pkey;\n\n\t\t") at postgres.c:1250
#32 0x00005568f280f432 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#33 0x00005568f277b61a in BackendRun (port=<optimized out>, port=<optimized out>) at postmaster.c:4531
#34 BackendStartup (port=<optimized out>) at postmaster.c:4259
#35 ServerLoop () at postmaster.c:1816
#36 0x00005568f277c78b in PostmasterMain (argc=<optimized out>, argv=0x5568f4c6eb80) at postmaster.c:1488
#37 0x00005568f249bb60 in main (argc=3, argv=0x5568f4c6eb80) at main.c:202
[Inferior 1 (process 248832) detached]

Run as:

make USE_PGXS=1 testgrescheck_part_1 TESTGRESCHECKS_PART_1="t.s3_test.S3Test.test_1"

Where:

  • t - folder with python tests
  • s3_test - test file name
  • S3Test - test class name
  • test_1 - test name

Tested on main
Commit 5bf650d

t/example_test.py:

import json
import logging
import os
import time
from threading import Thread
from typing import Optional

import boto3
from botocore import UNSIGNED
from botocore.config import Config
from moto.core import set_initial_no_auth_action_count
from moto.server import DomainDispatcherApplication, create_backend_app
from testgres.enums import NodeStatus
from werkzeug.serving import (BaseWSGIServer, make_ssl_devcert,
                              make_server)

from .base_test import BaseTest

log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

class S3Test(BaseTest):
	bucket_name = "test-bucket"
	host="localhost"
	port=5000
	iam_port=5001
	dir_path = os.path.dirname(os.path.realpath(__file__))
	user="ORDB_USER"
	region="us-east-1"

	@classmethod
	@set_initial_no_auth_action_count(4)
	def setUpClass(cls):
		cls.ssl_key = make_ssl_devcert('/tmp/ordb_test_key', cn=cls.host)
		cls.s3_server = MotoServerSSL(ssl_context=cls.ssl_key)
		cls.s3_server.start()
		cls.iam_server = MotoServerSSL(port=cls.iam_port, service='iam',
									   ssl_context=cls.ssl_key)
		cls.iam_server.start()

		iam_config = Config(signature_version = UNSIGNED)

		iam = boto3.client('iam', config=iam_config,
						   endpoint_url=f"https://{cls.host}:{cls.iam_port}",
						   verify=cls.ssl_key[0])
		iam.create_user(UserName=cls.user)
		policy_document = {
			"Version": "2012-10-17",
			"Statement": {"Effect": "Allow", "Action": "*", "Resource": "*"}
		}
		policy = iam.create_policy(PolicyName="ORDB_POLICY",
				 				   PolicyDocument=json.dumps(policy_document))
		policy_arn = policy["Policy"]["Arn"]
		iam.attach_user_policy(UserName=cls.user, PolicyArn=policy_arn)
		response = iam.create_access_key(UserName=cls.user)
		cls.access_key_id = response["AccessKey"]["AccessKeyId"]
		cls.secret_access_key = response["AccessKey"]["SecretAccessKey"]

	@classmethod
	def tearDownClass(cls):
		cls.s3_server.stop()
		cls.iam_server.stop()

	def setUp(self):
		super().setUp()

		session = boto3.Session(
			aws_access_key_id=self.access_key_id,
			aws_secret_access_key=self.secret_access_key,
			region_name=self.region
		)
		host_port = f"https://{self.host}:{self.port}"
		self.client = session.client("s3", endpoint_url=host_port,
									 verify=self.ssl_key[0])
		try:
			self.client.head_bucket(Bucket=self.bucket_name)
		except:
			self.client.create_bucket(Bucket=self.bucket_name)

	def tearDown(self):
		super().tearDown()
		objects = self.client.list_objects(Bucket=self.bucket_name)
		objects = objects.get("Contents", [])
		while objects != []:
			objects = list({"Key": x["Key"]} for x in objects)
			self.client.delete_objects(Bucket=self.bucket_name,
									   Delete={"Objects":objects})
			objects = self.client.list_objects(Bucket=self.bucket_name)
			objects = objects.get("Contents", [])

		self.client.delete_bucket(Bucket=self.bucket_name)
		self.client.close()
	
	
	def test_1(self):
		
		node = self.node
		node.append_conf('postgresql.conf', f"""
			orioledb.s3_mode = true
			orioledb.s3_host = '{self.host}:{self.port}/{self.bucket_name}'
			orioledb.s3_region = '{self.region}'
			orioledb.s3_accesskey = '{self.access_key_id}'
			orioledb.s3_secretkey = '{self.secret_access_key}'
			orioledb.s3_cainfo = '{self.ssl_key[0]}'
			orioledb.s3_num_workers = 1
		""")
		node.start()
		node.safe_psql("CREATE EXTENSION IF NOT EXISTS orioledb;")
		
		node.safe_psql("""
			
			CREATE SEQUENCE seq_1;
				 
			CREATE MATERIALIZED VIEW matview_1 (val_1, val_2, val_3, va_4)
				USING orioledb AS (VALUES (100, 1, 'a',
										nextval('seq_1'::regclass)),
										(100, 3, 'b',
										nextval('seq_1'::regclass)));
			
			CREATE INDEX ind_1 ON matview_1 (val_2 DESC);
			
			REINDEX INDEX ind_1;
			
		""")

		node.stop(['-m', 'immediate'])

		node.start()	

class MotoServerSSL:
	def __init__(self, host: str = "localhost", port: int = 5000,
				 service: Optional[str] = None, ssl_context=None):
		self._host = host
		self._port = port
		self._service = service
		self._thread: Optional[Thread] = None
		self._server: Optional[BaseWSGIServer] = None
		self._server_ready = False
		self._ssl_context = ssl_context

	def _server_entry(self) -> None:
		app = DomainDispatcherApplication(create_backend_app, self._service)

		self._server = make_server(self._host, self._port, app, False,
								   ssl_context=self._ssl_context,
								   passthrough_errors=True)
		self._server_ready = True
		self._server.serve_forever()

	def start(self) -> None:
		self._thread = Thread(target=self._server_entry, daemon=True)
		self._thread.start()
		while not self._server_ready:
			time.sleep(0.1)

	def stop(self) -> None:
		self._server_ready = False
		if self._server:
			self._server.shutdown()

		self._thread.join() 

Stuck stack

0x00007f7897b5b45a in epoll_wait (epfd=9, events=0x55f5d77eac78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
#0  0x00007f7897b5b45a in epoll_wait (epfd=9, events=0x55f5d77eac78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x000055f5d5c6543d in WaitEventSetWaitBlock (nevents=1, occurred_events=0x7ffdee7e89e0, cur_timeout=-1, set=0x55f5d77eac18) at latch.c:1489
#2  WaitEventSetWait (set=0x55f5d77eac18, timeout=-1, occurred_events=0x7ffdee7e89e0, nevents=1, wait_event_info=<optimized out>) at latch.c:1435
#3  0x000055f5d5c65858 in WaitLatch (latch=<optimized out>, wakeEvents=wakeEvents@entry=33, timeout=timeout@entry=-1, wait_event_info=wait_event_info@entry=134217758) at latch.c:497
#4  0x000055f5d5c73abf in ConditionVariableTimedSleep (wait_event_info=134217758, timeout=-1, cv=0x7f789552aea8) at condition_variable.c:163
#5  ConditionVariableTimedSleep (cv=0x7f789552aea8, timeout=-1, wait_event_info=134217758) at condition_variable.c:112
#6  0x00007f78971e6e46 in s3_queue_wait_for_location (location=0) at src/s3/queue.c:341
#7  0x00007f78971e8609 in s3_load_file_part (chkpNum=chkpNum@entry=0, datoid=datoid@entry=5, relnode=relnode@entry=16447, segNum=segNum@entry=0, partNum=partNum@entry=0) at src/s3/worker.c:454
#8  0x00007f78971e5ee8 in s3_header_lock_part (tag=..., index=index@entry=0) at src/s3/headers.c:658
#9  0x00007f7897196aad in btree_smgr_write (desc=desc@entry=0x55f5d784f1b0, buffer=buffer@entry=0x7f788695c050 "", chkpNum=0, amount=amount@entry=8192, offset=0) at src/btree/io.c:499
#10 0x00007f7897196e67 in write_page_to_disk (desc=desc@entry=0x55f5d784f1b0, extent=extent@entry=0x7ffdee7e8c48, page=page@entry=0x7f788695c050 "", page_size=8192) at src/btree/io.c:1069
#11 0x00007f7897198ab8 in perform_page_io_build (desc=desc@entry=0x55f5d784f1b0, img=img@entry=0x7f788695c050 "", extent=extent@entry=0x7ffdee7e8c48, metaPage=metaPage@entry=0x7ffdee7e8c60) at src/btree/io.c:1668
#12 0x00007f789718eabe in btree_write_index_data (desc=desc@entry=0x55f5d784f1b0, tupdesc=<optimized out>, sortstate=sortstate@entry=0x55f5d796db50, ctid=ctid@entry=1, file_header=file_header@entry=0x7ffdee7e8f60) at src/btree/build.c:420
#13 0x00007f78971b8cf2 in build_secondary_index (o_table=o_table@entry=0x55f5d7910340, descr=descr@entry=0x55f5d784b0f0, ix_num=ix_num@entry=0, in_dedicated_recovery_worker=in_dedicated_recovery_worker@entry=false) at src/catalog/indices.c:1343
#14 0x00007f78971ba0e9 in o_define_index (rel=rel@entry=0x7f7886aa84c0, indoid=indoid@entry=16446, reindex=<optimized out>, reindex@entry=true, skip_constraint_checks=skip_constraint_checks@entry=false, skip_build=skip_build@entry=false, context=context@entry=0x0) at src/catalog/indices.c:685
#15 0x00007f78971f0b09 in orioledb_define_index (rel=0x7f7886aa84c0, indoid=16446, reindex=<optimized out>, skip_constraint_checks=<optimized out>, skip_build=<optimized out>, arg=0x0) at src/tableam/handler.c:1279
#16 0x000055f5d5a1113b in table_define_index (arg=0x0, skip_build=false, skip_constraint_checks=false, reindex=true, indoid=16446, rel=0x7f7886aa84c0) at ../../../src/include/access/tableam.h:2184
#17 reindex_index (indexId=indexId@entry=16446, skip_constraint_checks=skip_constraint_checks@entry=false, persistence=persistence@entry=112 'p', params=params@entry=0x7ffdee7e921c) at index.c:3827
#18 0x000055f5d5aa81f2 in ReindexIndex (isTopLevel=true, params=0x7ffdee7e9214, indexRelation=<optimized out>) at indexcmds.c:2761
#19 ExecReindex (pstate=pstate@entry=0x55f5d7845530, stmt=stmt@entry=0x55f5d77f1328, isTopLevel=isTopLevel@entry=true) at indexcmds.c:2685
#20 0x000055f5d5c94bbe in standard_ProcessUtility (pstmt=pstmt@entry=0x55f5d77f14b0, queryString=queryString@entry=0x55f5d77ef6c0 "\n \n\t\t\tCREATE SEQUENCE seq_1;\n\t\t\t\t \n\t\t\tCREATE MATERIALIZED VIEW matview_1 (val_1, val_2, val_3, va_4)\n\t\t\t\tUSING orioledb AS (VALUES (100, 1, 'a',\n\t\t\t\t\t\t\t\t\t\tnextval('seq_1'::regclass)),\n\t\t\t\t\t\t\t\t\t\t(100, "..., readOnlyTree=<optimized out>, context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0, dest=0x55f5d790ad40, qc=0x7ffdee7e9700) at utility.c:960
#21 0x00007f78971b3b2d in orioledb_utility_command (pstmt=0x55f5d77f14b0, queryString=0x55f5d77ef6c0 "\n \n\t\t\tCREATE SEQUENCE seq_1;\n\t\t\t\t \n\t\t\tCREATE MATERIALIZED VIEW matview_1 (val_1, val_2, val_3, va_4)\n\t\t\t\tUSING orioledb AS (VALUES (100, 1, 'a',\n\t\t\t\t\t\t\t\t\t\tnextval('seq_1'::regclass)),\n\t\t\t\t\t\t\t\t\t\t(100, "..., readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, env=0x0, dest=0x55f5d790ad40, qc=0x7ffdee7e9700) at src/catalog/ddl.c:1002
#22 0x000055f5d5c9327f in PortalRunUtility (portal=portal@entry=0x55f5d78adc50, pstmt=pstmt@entry=0x55f5d77f14b0, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=0x55f5d790ad40, qc=0x7ffdee7e9700) at pquery.c:1158
#23 0x000055f5d5c933d4 in PortalRunMulti (portal=portal@entry=0x55f5d78adc50, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x55f5d790ad40, altdest=altdest@entry=0x55f5d790ad40, qc=qc@entry=0x7ffdee7e9700) at pquery.c:1315
#24 0x000055f5d5c93a61 in PortalRun (portal=portal@entry=0x55f5d78adc50, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x55f5d790ad40, altdest=altdest@entry=0x55f5d790ad40, qc=0x7ffdee7e9700) at pquery.c:791
#25 0x000055f5d5c8f652 in exec_simple_query (query_string=0x55f5d77ef6c0 "\n \n\t\t\tCREATE SEQUENCE seq_1;\n\t\t\t\t \n\t\t\tCREATE MATERIALIZED VIEW matview_1 (val_1, val_2, val_3, va_4)\n\t\t\t\tUSING orioledb AS (VALUES (100, 1, 'a',\n\t\t\t\t\t\t\t\t\t\tnextval('seq_1'::regclass)),\n\t\t\t\t\t\t\t\t\t\t(100, "...) at postgres.c:1250
#26 0x000055f5d5c91432 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#27 0x000055f5d5bfd61a in BackendRun (port=<optimized out>, port=<optimized out>) at postmaster.c:4531
#28 BackendStartup (port=<optimized out>) at postmaster.c:4259
#29 ServerLoop () at postmaster.c:1816
#30 0x000055f5d5bfe78b in PostmasterMain (argc=<optimized out>, argv=0x55f5d77e9b80) at postmaster.c:1488
#31 0x000055f5d591db60 in main (argc=3, argv=0x55f5d77e9b80) at main.c:202
[Inferior 1 (process 1863633) detached]

Run as:

make USE_PGXS=1 testgrescheck_part_1 TESTGRESCHECKS_PART_1="t.s3_test.S3Test.test_1"

Where:

  • t - folder with python tests
  • s3_test - test file name
  • S3Test - test class name
  • test_1 - test name

Tested on main
Commit 5bf650d

t/example_test.py:

import json
import logging
import os
import time
from threading import Thread
from typing import Optional

import boto3
from botocore import UNSIGNED
from botocore.config import Config
from moto.core import set_initial_no_auth_action_count
from moto.server import DomainDispatcherApplication, create_backend_app
from testgres.enums import NodeStatus
from werkzeug.serving import (BaseWSGIServer, make_ssl_devcert,
                              make_server)

from .base_test import BaseTest

log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

class S3Test(BaseTest):
	bucket_name = "test-bucket"
	host="localhost"
	port=5000
	iam_port=5001
	dir_path = os.path.dirname(os.path.realpath(__file__))
	user="ORDB_USER"
	region="us-east-1"

	@classmethod
	@set_initial_no_auth_action_count(4)
	def setUpClass(cls):
		cls.ssl_key = make_ssl_devcert('/tmp/ordb_test_key', cn=cls.host)
		cls.s3_server = MotoServerSSL(ssl_context=cls.ssl_key)
		cls.s3_server.start()
		cls.iam_server = MotoServerSSL(port=cls.iam_port, service='iam',
									   ssl_context=cls.ssl_key)
		cls.iam_server.start()

		iam_config = Config(signature_version = UNSIGNED)

		iam = boto3.client('iam', config=iam_config,
						   endpoint_url=f"https://{cls.host}:{cls.iam_port}",
						   verify=cls.ssl_key[0])
		iam.create_user(UserName=cls.user)
		policy_document = {
			"Version": "2012-10-17",
			"Statement": {"Effect": "Allow", "Action": "*", "Resource": "*"}
		}
		policy = iam.create_policy(PolicyName="ORDB_POLICY",
				 				   PolicyDocument=json.dumps(policy_document))
		policy_arn = policy["Policy"]["Arn"]
		iam.attach_user_policy(UserName=cls.user, PolicyArn=policy_arn)
		response = iam.create_access_key(UserName=cls.user)
		cls.access_key_id = response["AccessKey"]["AccessKeyId"]
		cls.secret_access_key = response["AccessKey"]["SecretAccessKey"]

	@classmethod
	def tearDownClass(cls):
		cls.s3_server.stop()
		cls.iam_server.stop()

	def setUp(self):
		super().setUp()

		session = boto3.Session(
			aws_access_key_id=self.access_key_id,
			aws_secret_access_key=self.secret_access_key,
			region_name=self.region
		)
		host_port = f"https://{self.host}:{self.port}"
		self.client = session.client("s3", endpoint_url=host_port,
									 verify=self.ssl_key[0])
		try:
			self.client.head_bucket(Bucket=self.bucket_name)
		except:
			self.client.create_bucket(Bucket=self.bucket_name)

	def tearDown(self):
		super().tearDown()
		objects = self.client.list_objects(Bucket=self.bucket_name)
		objects = objects.get("Contents", [])
		while objects != []:
			objects = list({"Key": x["Key"]} for x in objects)
			self.client.delete_objects(Bucket=self.bucket_name,
									   Delete={"Objects":objects})
			objects = self.client.list_objects(Bucket=self.bucket_name)
			objects = objects.get("Contents", [])

		self.client.delete_bucket(Bucket=self.bucket_name)
		self.client.close()
	
	
	def test_1(self):
		
		node = self.node
		node.append_conf('postgresql.conf', f"""
			orioledb.s3_mode = true
			orioledb.s3_host = '{self.host}:{self.port}/{self.bucket_name}'
			orioledb.s3_region = '{self.region}'
			orioledb.s3_accesskey = '{self.access_key_id}'
			orioledb.s3_secretkey = '{self.secret_access_key}'
			orioledb.s3_cainfo = '{self.ssl_key[0]}'
			orioledb.s3_num_workers = 1
		""")
		node.start()
		node.safe_psql("CREATE EXTENSION IF NOT EXISTS orioledb;")
		
		node.safe_psql("""

			CREATE TYPE custom_range AS range (subtype=int8);

			CREATE TABLE o_test_1(
				val_1 custom_range,
				val_2 int,
				PRIMARY KEY(val_1, val_2)
			)USING orioledb;

			DROP TYPE custom_range CASCADE;
			
		""")

		node.stop(['-m', 'immediate'])

		node.start()	

class MotoServerSSL:
	def __init__(self, host: str = "localhost", port: int = 5000,
				 service: Optional[str] = None, ssl_context=None):
		self._host = host
		self._port = port
		self._service = service
		self._thread: Optional[Thread] = None
		self._server: Optional[BaseWSGIServer] = None
		self._server_ready = False
		self._ssl_context = ssl_context

	def _server_entry(self) -> None:
		app = DomainDispatcherApplication(create_backend_app, self._service)

		self._server = make_server(self._host, self._port, app, False,
								   ssl_context=self._ssl_context,
								   passthrough_errors=True)
		self._server_ready = True
		self._server.serve_forever()

	def start(self) -> None:
		self._thread = Thread(target=self._server_entry, daemon=True)
		self._thread.start()
		while not self._server_ready:
			time.sleep(0.1)

	def stop(self) -> None:
		self._server_ready = False
		if self._server:
			self._server.shutdown()

		self._thread.join() 

Stuck stack

0x00007f9e6122545a in epoll_wait (epfd=9, events=0x55d3c99f1c78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
#0  0x00007f9e6122545a in epoll_wait (epfd=9, events=0x55d3c99f1c78, maxevents=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x000055d3c887a43d in WaitEventSetWaitBlock (nevents=1, occurred_events=0x7fff693bc3d0, cur_timeout=-1, set=0x55d3c99f1c18) at latch.c:1489
#2  WaitEventSetWait (set=0x55d3c99f1c18, timeout=-1, occurred_events=0x7fff693bc3d0, nevents=1, wait_event_info=<optimized out>) at latch.c:1435
#3  0x000055d3c887a858 in WaitLatch (latch=<optimized out>, wakeEvents=wakeEvents@entry=33, timeout=timeout@entry=-1, wait_event_info=wait_event_info@entry=134217758) at latch.c:497
#4  0x000055d3c8888abf in ConditionVariableTimedSleep (wait_event_info=134217758, timeout=-1, cv=0x7f9e5ebf4ea8) at condition_variable.c:163
#5  ConditionVariableTimedSleep (cv=0x7f9e5ebf4ea8, timeout=-1, wait_event_info=134217758) at condition_variable.c:112
#6  0x00007f9e608b0e46 in s3_queue_wait_for_location (location=0) at src/s3/queue.c:341
#7  0x00007f9e608b2609 in s3_load_file_part (chkpNum=chkpNum@entry=0, datoid=datoid@entry=5, relnode=relnode@entry=16463, segNum=segNum@entry=0, partNum=partNum@entry=0) at src/s3/worker.c:454
#8  0x00007f9e608afee8 in s3_header_lock_part (tag=..., index=index@entry=0) at src/s3/headers.c:658
#9  0x00007f9e60860aad in btree_smgr_write (desc=desc@entry=0x55d3c9a55b78, buffer=buffer@entry=0x7f9e5006b050 "", chkpNum=0, amount=amount@entry=8192, offset=0) at src/btree/io.c:499
#10 0x00007f9e60860e67 in write_page_to_disk (desc=desc@entry=0x55d3c9a55b78, extent=extent@entry=0x7fff693bc638, page=page@entry=0x7f9e5006b050 "", page_size=8192) at src/btree/io.c:1069
#11 0x00007f9e60862ab8 in perform_page_io_build (desc=desc@entry=0x55d3c9a55b78, img=img@entry=0x7f9e5006b050 "", extent=extent@entry=0x7fff693bc638, metaPage=metaPage@entry=0x7fff693bc650) at src/btree/io.c:1668
#12 0x00007f9e60858abe in btree_write_index_data (desc=desc@entry=0x55d3c9a55b78, tupdesc=<optimized out>, sortstate=<optimized out>, ctid=<optimized out>, file_header=<optimized out>) at src/btree/build.c:420
#13 0x00007f9e60883412 in rebuild_indices (old_o_table=old_o_table@entry=0x55d3c9b67090, old_descr=old_descr@entry=0x55d3c9a52090, o_table=o_table@entry=0x55d3c9b32668, descr=descr@entry=0x55d3c9a52030) at src/catalog/indices.c:1477
#14 0x00007f9e608838d9 in drop_primary_index (o_table=0x55d3c9b32668, rel=0x55d3c9a52090) at src/catalog/indices.c:1568
#15 o_index_drop (tbl=tbl@entry=0x7f9e50173830, ix_num=ix_num@entry=0) at src/catalog/indices.c:1615
#16 0x00007f9e6087fa0e in orioledb_object_access_hook (access=OAT_DROP, classId=1259, objectId=16454, subId=0, arg=0x7fff693bcbd4) at src/catalog/ddl.c:1468
#17 0x000055d3c862bbaa in RunObjectDropHook (classId=<optimized out>, objectId=<optimized out>, subId=<optimized out>, dropflags=dropflags@entry=0) at objectaccess.c:65
#18 0x000055d3c861d75b in deleteOneObject (flags=0, depRel=0x7fff693bce20, object=0x55d3c9a6d560) at dependency.c:1329
#19 deleteObjectsInList (targetObjects=0x55d3c9a4c7f0, depRel=0x7fff693bce20, flags=0) at dependency.c:308
#20 0x000055d3c861de58 in performMultipleDeletions (objects=objects@entry=0x55d3c9a4c648, behavior=DROP_CASCADE, flags=flags@entry=0) at dependency.c:471
#21 0x000055d3c86a414e in RemoveObjects (stmt=stmt@entry=0x55d3c99f7d68) at dropcmds.c:127
#22 0x000055d3c88a8e99 in ExecDropStmt (stmt=stmt@entry=0x55d3c99f7d68, isTopLevel=isTopLevel@entry=true) at utility.c:2003
#23 0x000055d3c88ab016 in ProcessUtilitySlow (pstate=0x55d3c9a4c530, pstmt=0x55d3c99f8060, queryString=0x55d3c99f66c0 "\n\n\t\t\tCREATE TYPE custom_range AS range (subtype=int8);\n\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 custom_range,\n\t\t\t\tval_2 int,\n\t\t\t\tPRIMARY KEY(val_1, val_2)\n\t\t\t)USING orioledb;\n\n\t\t\tDROP TYPE custom_range CA"..., context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, qc=0x7fff693bd5f0, dest=<optimized out>) at utility.c:1764
#24 0x000055d3c88a9a61 in standard_ProcessUtility (pstmt=pstmt@entry=0x55d3c99f8060, queryString=queryString@entry=0x55d3c99f66c0 "\n\n\t\t\tCREATE TYPE custom_range AS range (subtype=int8);\n\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 custom_range,\n\t\t\t\tval_2 int,\n\t\t\t\tPRIMARY KEY(val_1, val_2)\n\t\t\t)USING orioledb;\n\n\t\t\tDROP TYPE custom_range CA"..., readOnlyTree=<optimized out>, context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=params@entry=0x0, queryEnv=queryEnv@entry=0x0, dest=0x55d3c99f8150, qc=0x7fff693bd5f0) at utility.c:1074
#25 0x00007f9e6087db2d in orioledb_utility_command (pstmt=0x55d3c99f8060, queryString=0x55d3c99f66c0 "\n\n\t\t\tCREATE TYPE custom_range AS range (subtype=int8);\n\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 custom_range,\n\t\t\t\tval_2 int,\n\t\t\t\tPRIMARY KEY(val_1, val_2)\n\t\t\t)USING orioledb;\n\n\t\t\tDROP TYPE custom_range CA"..., readOnlyTree=<optimized out>, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, env=0x0, dest=0x55d3c99f8150, qc=0x7fff693bd5f0) at src/catalog/ddl.c:1002
#26 0x000055d3c88a827f in PortalRunUtility (portal=portal@entry=0x55d3c9ab4c50, pstmt=pstmt@entry=0x55d3c99f8060, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=0x55d3c99f8150, qc=0x7fff693bd5f0) at pquery.c:1158
#27 0x000055d3c88a83d4 in PortalRunMulti (portal=portal@entry=0x55d3c9ab4c50, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=false, dest=dest@entry=0x55d3c99f8150, altdest=altdest@entry=0x55d3c99f8150, qc=qc@entry=0x7fff693bd5f0) at pquery.c:1315
#28 0x000055d3c88a8a61 in PortalRun (portal=portal@entry=0x55d3c9ab4c50, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x55d3c99f8150, altdest=altdest@entry=0x55d3c99f8150, qc=0x7fff693bd5f0) at pquery.c:791
#29 0x000055d3c88a4652 in exec_simple_query (query_string=0x55d3c99f66c0 "\n\n\t\t\tCREATE TYPE custom_range AS range (subtype=int8);\n\n\t\t\tCREATE TABLE o_test_1(\n\t\t\t\tval_1 custom_range,\n\t\t\t\tval_2 int,\n\t\t\t\tPRIMARY KEY(val_1, val_2)\n\t\t\t)USING orioledb;\n\n\t\t\tDROP TYPE custom_range CA"...) at postgres.c:1250
#30 0x000055d3c88a6432 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#31 0x000055d3c881261a in BackendRun (port=<optimized out>, port=<optimized out>) at postmaster.c:4531
#32 BackendStartup (port=<optimized out>) at postmaster.c:4259
#33 ServerLoop () at postmaster.c:1816
#34 0x000055d3c881378b in PostmasterMain (argc=<optimized out>, argv=0x55d3c99f0b80) at postmaster.c:1488
#35 0x000055d3c8532b60 in main (argc=3, argv=0x55d3c99f0b80) at main.c:202

Run as:

make USE_PGXS=1 testgrescheck_part_1 TESTGRESCHECKS_PART_1="t.s3_test.S3Test.test_1"

Where:

  • t - folder with python tests
  • s3_test - test file name
  • S3Test - test class name
  • test_1 - test name