libnano / primer3-py

Simple oligo analysis and primer design
https://libnano.github.io/primer3-py
GNU General Public License v2.0
166 stars 44 forks source link

Error:free(): invalid pointer #111

Closed liuzy2008 closed 1 year ago

liuzy2008 commented 1 year ago

There are some problem with 1.2.1 and 1.2.2 (get from github source code ).

            primer_result=bindings.design_primers(
                seq_args={
                    'SEQUENCE_ID':str(seq_head),
                    'SEQUENCE_TEMPLATE':str(seq_seq),
                    },

                global_args=primer_setting
            )

I run this code in some django script. The core code bindings.design_primers casused the whole script stop with free(): invalid pointer in v 1.2.1 and no warning in v1.2.2. I run this in venv(virtualenv 20.17.1 from XX/mambaforge/lib/python3.10/site-packages/virtualenv/init.py) in Python 3.10.8:

arrow                            0.14.7
asgiref                          3.6.0
biopython                        1.81
bleach                           6.0.0
certifi                          2023.5.7
charset-normalizer               3.1.0
colorlog                         4.8.0
Cython                           0.29.34
Django                           4.0.10
django-appconf                   1.0.5
django-browser-reload            1.8.0
django-classy-tags               4.0.0
django-compressor                4.3.1
django-debug-toolbar             4.0.0
django-js-asset                  2.0.0
django-login-required-middleware 0.9.0
django-mptt                      0.13.4
django-nyt                       1.2.4
django-sekizai                   4.1.0
django-tinymce                   3.6.1
et-xmlfile                       1.1.0
idna                             3.4
loggable-jdv                     0.1.7
numpy                            1.24.3
openpyxl                         3.1.2
packaging                        23.1
Pillow                           9.5.0
pip                              22.3.1
primer3-py                       1.2.2
python-dateutil                  2.8.2
rcssmin                          1.1.1
requests                         2.30.0
rjsmin                           1.2.1
setuptools                       65.6.3
six                              1.16.0
sorl-thumbnail                   12.9.0
sqlparse                         0.4.4
tqdm                             4.65.0
urllib3                          2.0.2
webencodings                     0.5.1
wheel                            0.38.4
liuxiawei commented 1 year ago

same as:free(): double free detected in tcache 2

liuxiawei commented 1 year ago

The key problem was config for desgin: PRIMER_SECONDARY_STRUCTURE_ALIGNMENT. I found cancel it would solve problem

 core 0)
!!! uWSGI process 27541 got Segmentation Fault !!!
*** backtrace of 27541 ***
uwsgi(uwsgi_backtrace+0x31) [0x5563f46653d1]
uwsgi(uwsgi_segfault+0x32) [0x5563f4665842]
/lib64/libc.so.6(+0x36400) [0x7f57e50bf400]
/lib/python3.8/site-packages/primer3/thermoanalysis.cpython-38-x86_64-linux-gnu.so(thal+0x549e) [0x7f57d9c2249e]
/lib/python3.8/site-packages/primer3/thermoanalysis.cpython-38-x86_64-linux-gnu.so(recalc_primer_sec_struct+0x374) [0x7f57d9bede14]
/lib/python3.8/site-packages/primer3/thermoanalysis.cpython-38-x86_64-linux-gnu.so(recalc_secundary_structures+0x91) [0x7f57d9bee631]
/lib/python3.8/site-packages/primer3/thermoanalysis.cpython-38-x86_64-linux-gnu.so(choose_primers+0x2410) [0x7f57d9bff840]
/lib/python3.8/site-packages/primer3/thermoanalysis.cpython-38-x86_64-linux-gnu.so(+0x8f496) [0x7f57d9c5d496]
grinner commented 1 year ago

@liuxiawei Is this resolved for you or does an issue still exist?

liuxiawei commented 1 year ago

@liuxiawei Is this resolved for you or does an issue still exist?

Yes. The item PRIMER_SECONDARY_STRUCTURE_ALIGNMENT can not be set to 1.

PRIMER_SECONDARY_STRUCTURE_ALIGNMENT (boolean; default 0)

If the associated value = 1, then Primer3 will print out the calculated secondary structures, for example:
Dimers:

t: 7.8  dG: -1724  dH: -91400  dS: -289
  5' ACGCAAAGCACGCTCC-CGATC 3'
      ||   |||  |||   ||
3' CTAGCCC-TCGCACGAAACGCA 5'

Hairpins:

t: 36.4  dG: 42  dH: -22500  dS: -73
5' CGCAAAGCACGCT┐
            ||  │
        3' AGCCC┘

The tags [PRIMER_LEFT_4_SELF_ANY_STUCT](https://primer3.org/manual.html#PRIMER_LEFT_4_SELF_ANY_STUCT), [PRIMER_LEFT_4_SELF_END_STUCT](https://primer3.org/manual.html#PRIMER_LEFT_4_SELF_END_STUCT), [PRIMER_LEFT_4_HAIRPIN_STUCT](https://primer3.org/manual.html#PRIMER_LEFT_4_HAIRPIN_STUCT) (these tags are also present for RIGHT and INTERNAL primers), [PRIMER_PAIR_4_COMPL_ANY_STUCT](https://primer3.org/manual.html#PRIMER_PAIR_4_COMPL_ANY_STUCT) and [PRIMER_PAIR_4_COMPL_END_STUCT](https://primer3.org/manual.html#PRIMER_PAIR_4_COMPL_END_STUCT) are only present if a secondary structure could be calculated.

As the string has to fit on one line, the newlines are indicated by the two characters '\' and 'n' and have to be replaced (regex: /\\n/\n/g). Hairpins use unicode characters for the turn. For html they have to be replaced (regex: /U\+25(\d\d)/&#x25$1;/g).

I tried both debian and centos. I believe it still exists.

grinner commented 1 year ago

fixed in PR #112