Skip to content

[Bug] malloc issue when using obs_query #4437

Description

@royassis

Describe the bug

attr('sample') == val('xxx')
python: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
Aborted

To Reproduce

import tiledbsoma

exp = tiledbsoma.Experiment.open("s3://xxx")
# To anndata
measurement_name = "RNA"

print(len(exp.obs)) #2343203
print(len(exp.ms["RNA"]["var"])) #22653

## Var Query
gene_names = ["xxx"]
var_query = tiledbsoma.AxisQuery(value_filter=f'var_id in {gene_names}')

## Obs Query
first_obs_name="sample"
first_obs_value="xxx"


value_filter=f"attr('{first_obs_name}') == val('{first_obs_value}')"
print(value_filter)


obs_query = tiledbsoma.AxisQuery(value_filter=value_filter)

# Run query
query = exp.axis_query("RNA", obs_query=obs_query, var_query=var_query)
adata = query.to_anndata(X_name="data")

Versions (please complete the following information):

tiledbsoma.__version__              2.3.0
TileDB core version (libtiledbsoma) 2.30.0
python version                      3.13.1.final.0
OS version                          Linux 6.8.0-1050-aws

Additional context
When I remove the obs_query the error doesn't happen
query = exp.axis_query("RNA", var_query=var_query)

This is the platform_config used with tiledbsoma.io.from_anndata to create the data

max_n_obs = 1000
if len(ad.obs) > max_n_obs:
	obs_tile_extent = int(len(ad.obs) / 10)
else:
	obs_tile_extent = int(len(ad.obs))

var_tile_extent = 5

platform_config = tiledbsoma.options.TileDBCreateOptions(
	tile_order="col-major",
	cell_order="col-major",
	dims={
		"soma_dim_0": {"filters": [{"_type": "ZstdFilter", "level": 3}], "tile": obs_tile_extent},
		"soma_dim_1": {"filters": [{"_type": "ZstdFilter", "level": 3}], "tile": var_tile_extent},
	},
	attrs={
		"soma_data": {"filters": [{"_type": "ZstdFilter", "level": 3}]},
	},
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions