Python 3.x docker分段故障(堆芯倾倒),在这种情况下该怎么办?

Python 3.x docker分段故障(堆芯倾倒),在这种情况下该怎么办?,python-3.x,docker,flask,virtualbox,Python 3.x,Docker,Flask,Virtualbox,我曾尝试使用ulimit-c unlimited增加核心限制,但没有成功 我已经成功地在本地执行了代码,但是对于docker,我似乎遇到了一个我不理解的分段错误 我试图增加不起作用的基本设备存储。 我的docker机器由于某种原因没有basedevice存储 root@ramcharran-VirtualBox:/home/ramcharran/src# docker run -it dll_img /bin/bash bash-4.3# python3 app.py connection to

我曾尝试使用ulimit-c unlimited增加核心限制,但没有成功

我已经成功地在本地执行了代码,但是对于docker,我似乎遇到了一个我不理解的分段错误

我试图增加不起作用的基本设备存储。 我的docker机器由于某种原因没有basedevice存储

root@ramcharran-VirtualBox:/home/ramcharran/src# docker run -it dll_img /bin/bash
bash-4.3# python3 app.py
connection to cursor
registering tokenizer
virtual table created
inserted data into virtual table
Segmentation fault (core dumped)
bash-4.3#
编辑

以下是我的源代码:

root@ramcharran-VirtualBox:/home/ramcharran# docker info
Containers: 6
 Running: 0
 Paused: 0
 Stopped: 6
Images: 19
Server Version: 1.12.3
**Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 27**
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor seccomp
Kernel Version: 4.4.0-59-generic
Operating System: Ubuntu 16.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 8.046 GiB
Name: ramcharran-VirtualBox
ID: WRT4:KUPK:BFBA:EJ5G:XWT2:7FXX:UX42:NALM:FNNJ:Z4XV:X44U:NFOT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
 127.0.0.0/8
root@ramcharran-VirtualBox:/home/ramcharran#
OUTokenizer没有问题,我已经用gdb、valgrind对它进行了调试,并且在每个语句之后都使用了print,所有语句都没有错误地执行。执行OUtokenizer之后,数据插入到表中时,就会发生分段错误


请帮助我解决此问题。

问题在于flask使用子进程重新启动代码。 在调用tokenize()函数之前检查WERKZEUG_RUN_主环境变量,解决了这个问题

请参阅以下链接以了解WERKZEUG_RUN_主环境变量的用法


谢谢大家。

我尝试使用
sudo pip安装docker compose
并修复了。

docker本身并没有产生segfault,您的应用程序是。在没有看到你的应用程序之前,我不相信有可能回答这个问题。我无法让整个代码成为此评论的一部分。你能帮我找到链接吗?请。您正在运行的代码不应该是注释,它应该是对您的问题的编辑。上面有一个按钮。我在本地执行了上述代码,删除了“app.run(debug=True,host='0.0.0')”语句,代码正常执行,没有任何问题。为什么在docker上运行时会出现问题?
import json

import apsw
import sqlitefts as fts

import search
from search import OUWordTokenizer

from flask import Flask
app = Flask(__name__)

#tracker = SummaryTracker()
def tokenize():
    connection = apsw.Connection('texts.db', flags=apsw.SQLITE_OPEN_READWRITE)
    c = connection.cursor()
    print("connection to cursor")
    fts.register_tokenizer(c, 'oulatin', fts.make_tokenizer_module(OUWordTokenizer('latin')))
    print("registering tokenizer")
    c.execute("begin;")
    c.execute("CREATE VIRTUAL TABLE IF NOT EXISTS text_idx  USING fts3 (id, title, book, author, date, chapter, verse, passage, link, documentType, tokenize={});".format("oulatin"))
    c.execute("commit;")
    print("virtual table created")
    c.execute("INSERT INTO text_idx (id, title, book, author, date, chapter, verse, passage, link, documentType) SELECT id, title, book, author, date, chapter, verse, passage, link, documentType FROM texts;")
    print ("inserted data into virtual table")

@app.route('/')
def hello_world():
    print ("Hello world")
    search.word_tokenizer
    print ("word_tokenizers")
    return json.dumps({"name": "test"})


if __name__ == '__main__':
    tokenize()
    app.run(debug=True, host='0.0.0.0')
 #tracker.print_diff()