DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Trending

  • Testing Applications With JPA Buddy and Testcontainers
  • MLOps: Definition, Importance, and Implementation
  • Fun Is the Glue That Makes Everything Stick, Also the OCP
  • Hibernate Get vs. Load
  1. DZone
  2. Data Engineering
  3. Data
  4. Deleting Ain't Easy

Deleting Ain't Easy

Oren Eini user avatar by
Oren Eini
·
Nov. 09, 13 · Interview
Like (0)
Save
Tweet
Share
4.38K Views

Join the DZone community and get the full member experience.

Join For Free

We started getting test failures in Voron regarding being unable to clean up the data directory. Which was a major cause for concern. We thought that we had a handle leak, or something like that.

As it turned out, we could reproduce this issue with the following code:


 class Program
 {
     static void Main(string[] args)
     {
         var name = Guid.NewGuid().ToString();
         for (int i = 0; i < 1000; i++)
         {
             Console.WriteLine(i);
             Directory.CreateDirectory(name);
  
             for (int j = 0; j < 10; j++)
             {
                 File.WriteAllText(Path.Combine(name, "test-" +j), "test");
             }
  
             if (Directory.Exists(name))
                 Directory.Delete(name, true);
         }
         
     }
 }

If you run this code, in 6 out of 10 runs, it would fail with something like this:

I am pretty sure that the underlying cause is some low lever “thang” somewhere on my system. FS Indexing, AV, etc. But it basically means that directory delete is not atomic, and that I should basically just suck it up and write a robust delete routine that can handle failure and retry until it is successful.


Directory Data (computing) Lever Testing Forward secrecy

Published at DZone with permission of Oren Eini, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • Testing Applications With JPA Buddy and Testcontainers
  • MLOps: Definition, Importance, and Implementation
  • Fun Is the Glue That Makes Everything Stick, Also the OCP
  • Hibernate Get vs. Load

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: