Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Windows Tipps & SecurityGrafikkarte vor Überhitzung schützen: So geht’s(25.09.2026 um 08:00 Uhr)
••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

How Race Conditions Can Break Your System?

Overview Singleton, is a one of most popular design pattern. The main purpose is to saving memory by reuse and sharing one instance rather than create a new one. It sounds like a great concept, but it could be a "Boomerang" if we…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!




Overview



Singleton, is a one of most popular design pattern. The main purpose is to saving memory by reuse and sharing one instance rather than create a new one. It sounds like a great concept, but it could be a "Boomerang" if we implement that concept in the wrong case.



Helo, i am Satria. Currently i'm working on Tech Company as a Software Engineer. In this article i will share about my experience in implementing Singleton Design Pattern in the wrong case. So, let's go.






Problem Started



The Incident is started when i created an application to manage the budgeting system in our company. It is using PostgreSQL as a Database Management System. The application that i built is a part of Company's Super App.



When I looked at the code in the Super App, i notice that everytime when we need to query to database, we always use the same database connection and database session that declared as a global variable. here's the sample code




embed engine = create_engine(url)
Session = sessionmaker(bind=engine)
db = Session()






Everytime we need to querying to database, we always use db variable. For the first time, i thought




Hmm, This is good. we can reduce the memory usage




Everything going well when i test and debug the application by myself. But the problem occuring when i entering the UAT Process. A lot of issues coming from users in day 1,and 60% of issues is about Inconsistency Data. on the next day the same issue is still coming. and Users put the comment like this




Why my proposal data is not found?, Why my proposal data is different than i created before, why the approval process is stuck?







Resolving The Problem



At First i thought that the problem is coming from relationship between the table. So, i double-checked on the model and database schema. But, i found no problem with that. i also check the query to database, and still didn't find the problem, the query is fine.



I tried all flow of the application again, and still didn't find t the problem. I’m really stressed out by this issue, I spent 3 days just trying to find the problem. On day 3, i remember that my application is using same database session for all query. And when i check on entry point file, our app is using 4 worker and every worker can running up to 50 threads. That's caused the race condition because one database session is used by more than one Thread. So, i tried to refactor my code and create new database session in every function.




def create_proposal():
db_session = Session()
try{
....
except:
db_session.rollback()
finally:
db_session.close()






After i refactoring the code like above, The related issue is gone. And my application is ready to serve on Production.






Conclusion



Singleton is a good concept to reduce memory usage. but not all type of instances is good to use singleton. In this case, database connection is suitable to use Singleton, because the data doesn't change everytime it's used. But implementing a Singleton for a database session is a bad practice, because a database session can change every time it is used.



Linkedin

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Vulnerability Remediation & Verification
Syntax validiert (0 Fehler)
title: Detect Exploitation - How Race Conditions Can Break Your System?
id: 393e51fc-ae22-4c70-91e3-e9a760dc2e75
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-26
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-26"
        description = "YARA Signature for "
    strings:
        $str = "How Race Conditions Can Break " ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("How Race Conditions Can Break Your Syste")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*How Race Conditions Can Break Your Syste*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "How Race Conditions Can Break Your Syste"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How Race Conditions Can Break Your Syste.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How Race Conditions Can Break Your System?

Thematisch verwandte Begriffe: Race, Conditions, Break, Your · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-100661 | Netty's HTTP/3 codec (io.netty:netty-codec-http3) versions 4.2.0.Final …
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag