title: Received error Segmentation fault (core dumped)
body: <p>I made a program which will take the logs from a camera, parse it for every line to see if the log from a file I created is in the log line and if it is count how many times the proper log is triggered.</p>
  <pre><code>from collections import deque
  import sys
  import os
  from threading import Thread
  from time import sleep
  
  sys.path.append(os.path.abspath(os.path.dirname(os.path.dirname('../'))))
  
  from livelogparser.clientlogParser import ClientLogParser 
  from PyQt5 import QtCore, QtWidgets
  from PyQt5.QtCore import QThread, QObject
  from PyQt5.QtGui import QTextCursor
  
  ON_POSIX = 'posix' in sys.builtin_module_names
  
  class Ui_logWindow(object):
      def logs(self):
          arg1 = self.lineEdit.text()
          arg2 = int(self.lineEdit_2.text())
          arg3 = self.lineEdit_3.text()
          arg4 = self.lineEdit_4.text()
          arg5 = self.lineEdit_5.text()
          arg6 = self.lineEdit_6.text()
          self.q = deque()
          #on_message comes from ClientLogParser class
          self.client = ClientLogParser(arg1, arg2, arg3, arg4, arg5, arg6)
          self.client.client.on_message = self.onMsgWin
          #startListen is loop_forever()
          self.t = Thread(target=self.client.startListen, args=[])
          self.t.daemon = True
          self.t.start()
  
      def onMsgWin(self, client, userdata, msg):
          self.listMsg = msg.payload.decode('utf-8').rstrip()
          self.textEdit.append(self.listMsg)
          self.textEdit.moveCursor(QTextCursor.End)
          for line in self.listMsg.split('\n'):
              self.client.lp.parseEvent(line)
              self.q.append(line)
              if len(self.q) &lt; 20:
                  output_GUI = ''
                  for line in self.q:
                      self.client.rp.evaluateDict(self.client.lp.dictLogs)
                      output_GUI += &quot;COUNT:\n&quot;
                      for key, val in self.client.lp.dictLogs.items():
                          output_GUI += f&quot;EVT[{key}] COUNT[{val}]\n&quot;
                          if val &gt; 0:
                              output_GUI += f'------ the event : {key} has been triggered ------\n'
                      output_GUI += &quot;RULES:\n&quot;
                      for rule_idx in range(len(self.client.rp.dictRulesList)):
                          if self.client.rp.resultList[rule_idx] == 'critical':
                              sys.exit(-1)
                          if self.client.rp.resultList[rule_idx] == 'warning':
                              output_GUI += '----------succes----------\n'
                          if self.client.rp.resultList[rule_idx] == 'info':
                              output_GUI += '----------succes----------\n'
                          if self.client.rp.resultList[rule_idx] == 'succes':
                              output_GUI += '----------succes----------\n'
                          output_GUI += f&quot;RULE:[{rule_idx}][{self.client.rp.dictRulesList[rule_idx]}]\n&quot;
                          output_GUI += f&quot;RESULT[{rule_idx}][{self.client.rp.resultList[rule_idx]}]\n&quot;
                      output_GUI += &quot;----ITERATION-END----\n&quot;
                  self.textEdit_2.append(output_GUI)
                  self.textEdit_2.moveCursor(QTextCursor.End)
              else:
                  sleep(5)
                  self.q.clear()
                  continue
  </code></pre>
  <p>The problem is, sometime the program is working and it prints me in <code>textEdit_2</code> what I need, sometimes it is crashing with error <em>&quot;Segmentation fault (core dumped)&quot;</em>.</p>
  <p>I tried to make a queue which will take 20 line (because the log lines are coming very fast like 30-40 in 3-4 sec), parse them and add them into <code>editText_2</code>, sleep for 5 sec and then do it again, but is the same result.
  <code>edit_Text</code> is appending every log line as it is from the camera.
  Can anybody help me please?</p>