Questions tagged [fail-fast]

Anything related to fail-fast error management strategy, i.e. that software design principle requiring that in case of error a unit of code encapsulation (a module, a function, a method, etc.) should fail in the shortest possible time, reporting a failure to its client code in a clear and unambiguous way.

fail-fast
Filter by
Sorted by
Tagged with
19 votes
3 answers
2k views

Null checking with primary constructor in C# 12

I using C# 12. In C# 12 I can use primary constructor: public class UserService(IUnitOfWork uow) : IUserService { } Before C# 12 I used null checking for items that I inject in constructor: public ...
Milad Ahmadi's user avatar
1 vote
1 answer
650 views

Crash C# Application and Generate Dumps

I'm trying to generate dumps for my C# application, I used the FailFast method to "Immediately terminates a process after writing a message to the Windows Application event log, and then includes ...
dxtr's user avatar
  • 695
1 vote
1 answer
72 views

How can I change my Iterator to be a Fast-fail Iterator?

I'm trying to understand how to modify the Iterator of my Linked List to be fail-fast. I understand what it means for an Iterator to be fail-fast, but I don't know how exactly should I change my ...
May Sohatchevzzki's user avatar
1 vote
0 answers
2k views

Error : The application requested process termination through System.Environment.FailFast(string message)

i am in a little bit of a pickle, so about 3 weeks ago i start working on my own wpf project, for some reason when i minimize my window, it crashes (i am just using windowstate to minimize ) and my ...
Sye's user avatar
  • 17
4 votes
0 answers
203 views

is there a "fail fast" option for flutter tests?

to save time and money both locally and in CICD I would like to add "fail fast" to my flutter tests but I cannot find it in the official docs is there a way to do that?
aoatmon's user avatar
  • 547
-3 votes
1 answer
246 views

How can we handle the Java ConcurrentModificationException using try-catch?

I am trying to handle the java ConcurrentModificationException exception using try-catch block but still I am getting the same error when compiling the code. import java.util.*; public class failFast{ ...
Harshika Surasena's user avatar
0 votes
2 answers
1k views

Fail Fast When Kafka Consumer Can't Connect

For my own purposes, I need the Spring Boot application to stop if the Kafka Consumer can't connect to the broker. I mean, when Kafka Consumer trying to pool messages, we can see the following logs: [...
Oleksandr's user avatar
  • 470
1 vote
0 answers
807 views

Tomcat maxThreads & acceptCount tuning for Fail-Fast

I would like to tune Tomcat to fail-fast in case of any issues when all threads are occupied ( for example, waiting for a database connection if suddenly database starts to perform badly ). I checked ...
user3489820's user avatar
  • 1,519
2 votes
1 answer
298 views

java.util.ConcurrentModificationException while mutating an object

I am iterating over a List of CustomObject and while doing this iteration, I am mutating this object by adding a tag to tags list of this custom object. I am not adding or removing any CustomObject to ...
Mr Matrix's user avatar
  • 1,228
2 votes
1 answer
1k views

Spring boot app will not fail fast when custom transaction manager fails to connect

I am making a spring boot app with a custom transactionManager with its own datasource like so. Btw I'm using hikariCP as the datasource @Configuration @EnableTransactionManagement @...
anonuser1234's user avatar
1 vote
1 answer
1k views

Implementing a fail-fast design with promises in JavaScript

I'm not sure if "fail-fast" is the best way to describe this methodology, but ever since I started to learn about programming I have always been taught to design functions like this: function ...
Kenny83's user avatar
  • 866
4 votes
1 answer
58 views

Why I'm not getting ConcurrentModificationException while removing element from ArrayList during iteration [duplicate]

I am using the following code to loop through an arraylist and then removing one element from the arraylist. Here i'm expecting ConcurrentModificationException. But didn't get that exception. ...
Naveen's user avatar
  • 346
1 vote
2 answers
652 views

How Fail-fast Iterator works internally? [duplicate]

I know what is a fail-fast and fail-safe iterator. Fail-Fast iterators immediately throw ConcurrentModificationException if there is a structural modification of the collection. Fail-Safe doesn't ...
JAGRITI BANSAL's user avatar
9 votes
3 answers
27k views

How to use failFast in dynamic pipeline in Jenkins

I have pipeline which has dynamic parallel stages and I want my pipeline to fail fast, if any of the stage fail. I tried to add failFast: true but my pipeline is stuck at "Failed at Stage ABC". ...
aditi gupta's user avatar
-3 votes
1 answer
324 views

Linux: How to cat stdout of a process until the end, but stop and return a non-zero code if certain string appears?

We have a tool that runs tests, but does return an error code if they fail. The tool runs the tests after starting logging in through SSH to a custom console (not bash) and issuing a command. All ...
Ondra Žižka's user avatar
1 vote
2 answers
664 views

Will Environment.Exit(int) kill my application with treads running unmanaged code?

I have a windows service which runs unmanaged code (using DllImport) in different threads. Sometimes, the unmanaged code 'hangs'. Think of while (true) ;. When that happens, I need to kill the entire ...
Tvde1's user avatar
  • 1,264
0 votes
1 answer
397 views

How can I make JAXB to fail when a mandatory element is missing?

I'm trying to add some forward compatibility to a Java application calling a Web Service at work, but JAXB seems to behave backward on the subject... The application use the wsdl2java Maven plugin to ...
CidTori's user avatar
  • 399
1 vote
0 answers
627 views

Is there an elegant way run Go module tests with nested packages in parallel in a fail fast manner?

I have a Go project that uses modules. The module contains many packages, which are nested. When I let Go figure out the package structure by passing ./... to go test it runs the tests in parallel (...
Rok's user avatar
  • 807
1 vote
3 answers
429 views

Java - Will concurrent modification exception occur while using classic for loop?

Is there is a chance for getting concurrent modification exception occur while using classic for loop? import java.util.*; class IterTest{ public static void main(String[] args){ List<...
JavaUser's user avatar
  • 26k
1 vote
2 answers
866 views

What will Environment.FailFast do in .NET Core, when deployed to a Linux environment?

The docs for this method say: Immediately terminates a process after writing a message to the Windows Application event log, and then includes the message and optional exception information in ...
mikesigs's user avatar
  • 11k
1 vote
0 answers
194 views

throw exceptions for unknown Spring properties

I made a very silly mistake in my Spring Boot app's YAML config: --- spring: profiles: local ... ___ spring: profiles: foo ... --- spring: profiles: active: bar include: ...
Nate Glenn's user avatar
  • 6,633
1 vote
0 answers
66 views

Fail-Fast Iterator for an Stack

I want to implement a Fail-Fast Iterator to remove Entrys from my own List and test it on correct behaviour. The List holds Elements of the type MyEntry. These Entrys hold an Generic Value and a ...
Trikalium's user avatar
0 votes
1 answer
243 views

How to stop existing request execution to stop and just run fallback method in hystrix

In hystrix,I am using execution.isolation.thread.timeoutInMilliseconds this configuration to limit the response in some specific time else go for fallback method,But this setting is also executing the ...
Ankush Nakaskar's user avatar
2 votes
0 answers
30 views

ArrayList Failfast ConcurrentModificationException [duplicate]

package com.test; import java.util.ArrayList; import java.util.Iterator; public class TestList { public static void main(String[] args) { ArrayList<String> list = new ArrayList&...
Rajendra Lakshman Singh Thakur's user avatar
-1 votes
1 answer
1k views

Why we need fail fast and fail safe software design? [closed]

We know Java has fail-fast and fail-safe iteration design. I want to know , why we need these basically. Is there any fundamental reason for this separation? . What is the benefit of this design?. ...
JavaUser's user avatar
  • 26k
43 votes
5 answers
33k views

How to make Spring server to start even if database is down?

I'm using a Spring Boot(1.4.7) & MyBatis. spring.main1.datasource.url=jdbc:mariadb://192.168.0.11:3306/testdb?useUnicode=true&characterEncoding=utf8&autoReconnect=true&socketTimeout=...
Cs lee's user avatar
  • 443
2 votes
2 answers
69 views

Why isn't ConcurrentModificationException being thrown here?

Look at this little piece of code: ArrayList al = new ArrayList(); al.add("AA"); al.add("AB"); al.add("AC"); Iterator it = al.iterator(); while(it.hasNext()){ String s = (String)it.next(); if(s....
Aakash Verma's user avatar
  • 3,874
0 votes
1 answer
54 views

Fail Safe Fail Fast Example

ConcurrentHashMap<String, Integer> hm = new ConcurrentHashMap<>(); hm.put("1", 1); hm.put("2", 2); hm.put("3", 3); Iterator<String> itr = hm.keySet().iterator(); ...
VKN's user avatar
  • 1
1 vote
2 answers
84 views

Declaring an Iterator before adding elements to a Collection

If you create your own Iterable container class and retrieve a java.util.Iterator over its elements, is there any coding pattern according to which any further additions of elements in the container ...
Jason's user avatar
  • 2,796
1 vote
2 answers
475 views

bash on ubuntu 16: set -e not inheriting inside subshell

When I run this command set -e; echo $(echo "$-"); I get himBH as the output. I was expecting the letter e to be included in the output. Whats going on? I'm on Ubuntu 16.04.1 LTS with GNU bash, ...
american-ninja-warrior's user avatar
4 votes
0 answers
251 views

Protractor-fail-fast npm fails spec and doesn't run the rest specs (tests) in config file (using Protractor with Jasmine)

I have an issue while using npm protractor-fail-fast. ( https://www.npmjs.com/package/protractor-fail-fast ) If one spec file is failed, the rest specs will be NOT executed (NOT GOOD). I'm searching ...
Alex Svyatenko's user avatar
1 vote
0 answers
145 views

How do I throw an exception when I get multiple elements but I'm supposed to get only one?

I'm worried about this code: knex('person').where('id','=', 1).then(result => { const person = result[0]; // the code I worry - result should contain only ONE element }); If I was using C#, I ...
Hao's user avatar
  • 8,087
34 votes
3 answers
16k views

Gracefully handling corrupted state exceptions

Related to this question, I would like to force CLR to let my .NET 4.5.2 app catch Corrupted State Exceptions, for the sole purpose of logging them and then terminating the application. What's the ...
Lou's user avatar
  • 4,344
19 votes
2 answers
35k views

Hystrix Configuration

I am trying to implement hystrix for my application using hystrix-javanica. I have configured hystrix-configuration.properties as below hystrix.command.default.execution.isolation.strategy=SEMAPHORE ...
Jay's user avatar
  • 429
0 votes
2 answers
1k views

Multiple threads using iterator.remove() on a single collection returning fail-fast iterator

Oracle says Note that Iterator.remove is the only safe way to modify a collection during iteration; the behavior is unspecified if the underlying collection is modified in any other way while the ...
Aakash Verma's user avatar
  • 3,874
0 votes
1 answer
145 views

Why Hashmap fail-fast not happen in the resize function? (for multiple thread race condition issue)

All, I was trying to understand the multiple thread race condition issue for the Hashmap resize function. As I read from here. The race condition issue will cause the infinite loop link for the entry ...
Joe.wang's user avatar
  • 11.6k
1 vote
0 answers
118 views

Webservice functional/integration test with Junit

The question aims to find a better solution than mine. I have the following REQUIREMENTS for my integration tests: Each integration test is implemented in a single test class. The methods in a test ...
eventhorizon's user avatar
  • 3,197
3 votes
1 answer
78 views

Can I override `$` or `[[` to throw an error instead of NULL when asking for a missing list element?

My hunch is this is an abuse of the R language and there's a good reason this doesn't happen. But I find this to be a perpetual source of insidious errors in code that I'm trying to debug: MWE list....
Philip's user avatar
  • 7,263
0 votes
1 answer
80 views

Why Iterators fail fast and are they truly fail fast?

Iterators in Java are fail-fast. If an iterator values change while it is being iterated over, an exception is thrown. Is this purely to be safe? I am sure that in some cases, it doesn't matter that ...
More Than Five's user avatar
2 votes
7 answers
845 views

Fail fast iterators in Java

public class Alpha { public static void main(String[] args) { ArrayList<String> al = new ArrayList<String>(); al.add("a"); al.add("b"); al.add("c"); ...
Ramya's user avatar
  • 105
1 vote
0 answers
803 views

Spring Batch: OutOfMemoryError swallowed

As part of a larger application, I set up a Spring Batch job that is made up by just a chunk oriented tasklet: reader, processor and writer. The job is not run in the main thread. Occasionally the ...
danidemi's user avatar
  • 4,586
1 vote
1 answer
547 views

Why is generic instantiation syntax disallowed in Hack?

From the docs: Note: HHVM allows syntax such as $x = Vector<int>{5,10};, but Hack disallows the syntax in this situation, instead opting to infer it. Is there a specific reason for this?...
Maciej Sz's user avatar
  • 11.7k
2 votes
2 answers
2k views

How to make Storm halt on exception?

By default, when a Storm spout or bolt encounters an exception, it restarts the spout or bolt and tries again. Is there any configuration option to make it stop the topology, perhaps after N repeated ...
Jim Pivarski's user avatar
  • 5,766
1 vote
2 answers
622 views

Design by Contract and Fail Fast

Fail Fast - Fail-fast is a property of a system or module with respect to its response to failures. A fail-fast system is designed to immediately report at its interface any failure or ...
user2648176's user avatar
4 votes
5 answers
4k views

fail-fast iterator

I get this definition : As name suggest fail-fast Iterators fail as soon as they realized that structure of Collection has been changed since iteration has begun. what it mean by since iteration has ...
joy's user avatar
  • 721
2 votes
2 answers
729 views

Cannot understand this comment about fail-fast

In HashSet.java in JDK 1.6, there are some comments about the fail-fast property of HashSet's iterator. The iterators returned by this class's iterator method are fail-fast: if the set is modified ...
Heejin's user avatar
  • 4,533
-1 votes
4 answers
1k views

Why is there no error when using iterator.remove?

If I use Iterator.remove(), everything is fine. If I use ArryaList.remove(), I always receive the error java.util.ConcurrentModificationException. Can anyone point out the reason?
Adam Lee's user avatar
  • 25.3k
1 vote
0 answers
242 views

Detect if Serializable object is really serializable?

Is there a built-in method - or can someone point me to a good pattern - for determining whether an object that implements Serializable is actually serializable at construction time? I need something ...
Matt Mills's user avatar
  • 8,742
21 votes
2 answers
1k views

How to combine defensive programming techniques together?

The question I want to ask you is quite wide but in the same time it's very concrete. First, I have to say, that I mostly interested in answers which are applicable in the .net environment. Well, I ...
Igor Soloydenko's user avatar
7 votes
3 answers
2k views

Why are fail fast style programs shorter than defensive style programs?

I have read about how the fail-fast style of programming in languages like Erlang end up with much shorter programs than the defensive style found in most other languages. Is this correct for all ...