Questions tagged [reentrancy]
Reentrancy usually refers to subroutines, functions, methods and mutexes. A subroutine is considered reentrant if it can be safely called before a previous call has completed.
202
questions
0
votes
0answers
14 views
Does reentrant lock make function reentrant?
I have function that accesses a global variable. By definition it is not reentrant. But if I wrap around the resource with an reentrant lock, does that make the function reentrant?
1
vote
1answer
781 views
Does Solidity function with payable modifier allow to perform msg.sender.call{}
Found out that there are error in my own code. Answered my own question
I am beginner of Solidity programming, and came across with reentrancy risk. I have tested script below in remix and it works ...
1
vote
1answer
94 views
Pattern for cancel async method on reentry
I want to cancel an async function on reentrancy, so that the work do not get stacked up and unneeded work is prevented.
e.g. my file scanning can take up to 8 seconds, but when I change the folder in ...
2
votes
1answer
101 views
Why can sig_atomic_t be used in a reentrant function
I've been developing C++ on Linux for a long time. And when I develop some independent module processing a message/task queue, I always process the SIGINT signal to avoid message/task loss. Here is an ...
1
vote
2answers
95 views
What is the significance of having a function reentrant in a single-threaded environment?
What is the significance of having a function reentrant in a single-threaded environment?
I understood that for a function to be reentrant it needs to be able to be interrupted, entered by another ...
0
votes
1answer
23 views
FFTW reentrancy in plug-in based programs
I'm developing a cross-platform application (Win / Mac / Linux). This application loads plug-ins that I don't control as dynamic libraries, which may do various things, mostly audio and image ...
0
votes
2answers
45 views
TK spinbox goes into infinite cycle of updating GUI
I cannot fix a strange behavior of spinbox. Specifically, I need to update GUI at changing the spinbox's value, by means of -command and update in it.
The code a bit simplified is like:
package ...
1
vote
1answer
78 views
Which standard c++ functions and types support reentrancy?
The C++ Standard (c++14 and also the current working draft) states that
Except where explicitly specified in this document, it is
implementation-defined which functions in the C++ standard library ...
1
vote
1answer
49 views
Reentrancy in synchronized methods
Are synchronized methods reentrant?
I have this code:
public class Main {
synchronized void m1() {
//some code
m2();
//some code
}
synchronized void m2(){
...
1
vote
1answer
238 views
yydestruct too few arguments to function call (flex&bison)
I'm trying to make a reentrant flex&bison parser but I got this strange error:
too few arguments to function call, expected 5, have 4
I can see that the code generated by Bison looks like this:
...
0
votes
0answers
21 views
Re-issuing COM call on the UI thread
I am trying to decipher the paragraph below, taken from a blog post here which describes COM history in the context of the development for the Visual Studio IDE:
When everything was C++ native code, ...
3
votes
2answers
137 views
Deduce if a program is going to use threads
Thread-safe or thread-compatible code is good.
However there are cases in which one could implement things differently (more simply or more efficiently) if one knows that the program will not be using ...
1
vote
1answer
85 views
Is the Lock by the LockService in google app script reentrant or non-reentrant?
I am experimenting on implementing a simple row level locking for google sheets. (Conscious about concurrent accesses butching the data. Am I just being paranoid?). I've come across the LockService ...
0
votes
1answer
36 views
Defend Against Reentrancy and Invariant Violations When Using INotifyPropertyChanged?
When using INotifyPropertyChanged there is a risk of reentrancy bugs because the PropertyChanged event handler could call a method on the sender directly or indirectly. Because the typical ...
0
votes
1answer
241 views
Reentrant Bison/Flex, how to get error message for each instance of yyscan_t
I'm trying to create a program that uses multithreading with flex/bison to parse large amounts of data. I am slightly lost on how to get yyerrorin a reentrant way.
In a previous non-reentrant test ...
1
vote
1answer
48 views
Accessing yyout in a reentrant Bison-generated parser
Is there a regular way to access the function yyget_out(scanner) or the variable yyout from a reentrant Bison-generated parser?
I want to write a message to the lexer's yyout while in the parser ...
0
votes
1answer
39 views
Clarifying how GNU C Library defines nonreentrant functions
Taken from: https://www.gnu.org/software/libc/manual/html_node/Nonreentrancy.html
For example, suppose that the signal handler uses gethostbyname. This function returns its value in a static object,...
0
votes
1answer
99 views
per thread c++ guard to prevent re-entrant function calls
I've got function that call the registry that can fail and print the failure reason.
This function can also be called directly or indirectly from the context of a dedicated built-in printing ...
0
votes
0answers
120 views
How do I load a non-reentrant C++/CLI DLL twice in C#?
I'm attempting to load a C++/CLI DLL into my C# program. The DLL exposes its main class as a singleton because it contains C code with a lot of global variables. So, unfortunately, the DLL is non-...
1
vote
1answer
66 views
Re-entrancy not reproduceable
Short description
I was playing with the re-entrancy and mis-use of tx.origin example from solidity readthedocs.
This example shows how a user wallet can be tricked into having all of the calling ...
4
votes
1answer
2k views
Detect the same goroutine calling sync.Mutex.Lock() twice in a row
This code (a single threaded program) will never work:
func TestDoubleLockPanics(t *testing.T) {
var mu sync.Mutex
mu.Lock()
mu.Lock()
}
However, when I run this test, there's no panic. ...
0
votes
2answers
86 views
Is this function re-entrant?
DNM_Manager.c
struct DNM_s
{
uint32_t Addr;
uint32_t SerialNum;
uint32_t SubnetMask;
uint16_t Tick;
uint8_t Name[NAME_SIZE];
}DNMTemp;
pDNM DNMManager_New(void) //reentrant?
{
...
0
votes
1answer
53 views
Reentrant Function
Hello in the article from https://www.embedded.com/design/operating-systems/4008268/2/Back-to-the-Basics--Practical-Embedded-Coding-Tips-Part-1, there is mention on how to make a function reentrant.
...
-1
votes
1answer
614 views
What is the relation between reentrant kernel and preemptive kernel?
What is the relation between reentrant kernel and preemptive kernel?
If a kernel is preemptive, must it be reentrant? (I guess yes)
If a kernel is reentrant, must it be preemptive? (I am not sure)
...
3
votes
2answers
108 views
Will the following code execute successfully?
In Brian Goetz's Java Concurrency in Practice, there is following example which explains the reentrancy of the locks in Java as:
public class Widget {
public synchronized void doSomething() {
.....
1
vote
1answer
269 views
Smart contract good practice for reentrancy attacks
I'm a rookie working with solidity and blockchain technologies and I was reading some good practices to improve my code.
And I have a question about a code that I'm not quite understanding very well:...
2
votes
1answer
168 views
Why is my re-entrancy attack failing when executed in a constructor?
I am trying to recreate a re-entrancy attack using the vulnerable below:
https://ropsten.etherscan.io/address/0xe350eef4aab5a55d4efaa2aa6f7d7420057eee2a#code
And the exploitation contract below:
...
3
votes
2answers
144 views
How can I make my factorial function reentrant?
I am supposed to write a reentrant factorial function, when I searched what a reentrant function is, I found many definitions, such as a reentrant function shouldn't use static or global variable,and ...
2
votes
1answer
897 views
Should I make subVIs in preallocated VI as preallocated too in LabVIEW?
I have got a VI which execution type is set to be as preallocated clone reentrant.
In the VI i have several SubVIs. Should I set the execution type of SubVIs the same as in the main VI?
Thank you
3
votes
1answer
828 views
What does “Using non reentrant iterator method: Array.iterator()” error message mean?
This is my first project in libGDX and I am trying to loop a com.badlogic.gdx.utils.Array:
//properties
...
private Array<Item> items;
...
//constructor
...
items = new Array<Item>();
....
0
votes
2answers
166 views
Is tensorflow's session run interface reentrant?
I'm just wondering if tensorflow's session run interface is reentrant because in my case, multiple threads may access the same session.
btw, I use tensorflow's c++ api.
0
votes
0answers
28 views
Android an NDK method has a reentrancy issue
This is my NDK method:
void FrameReceived(int width, int height, const char *rawImageBytes, int size, jboolean remote)
{
//LOGE(".... **** ....FrameReceived Begin = %d", size);
if(size == 0)
...
0
votes
1answer
32 views
Difference between Lock and synchronize
In an interview I was asked about the difference between Lock and synchronize.
Which will I should prefer.
Logically I find both as same. We can achieve all the task using any of them. But not able to ...
3
votes
1answer
372 views
Python: How to create a concurrent-safe reentrant context manager which is different in every context
I want to have an object conManager that is a reentrant context manager instance such that whenever I enter and exit its context it will print a number, but the number must be one higher than the ...
0
votes
1answer
69 views
Does a milter callback really need to be re-entrant?
I need to develop a milter for Sendmail and have thought a long time about which language / framework I should use. Finally, I have decided to do it in plain C directly using the milter API.
I have ...
0
votes
0answers
42 views
How can one make a routine, which uses global variables and blocks on a semaphore, a re-entrant routine?
The routine uses global variables
The routine blocks on a semaphore, sleep
The routine should be re entrant.
21
votes
2answers
5k views
How to explain the reentrant RuntimeError caused by printing in signal handlers?
Code:
# callee.py
import signal
import sys
import time
def int_handler(*args):
for i in range(10):
print('INTERRUPT', args)
sys.exit()
if __name__ == '__main__':
signal.signal(...
0
votes
1answer
458 views
Avoiding deadlock in reentrant code C++11
I am working on refactoring some legacy code that suffers from deadlocks. There are two main root causes:
1) the same thread locking the same mutex multiple times, which should not difficult to ...
0
votes
2answers
392 views
oracle reentrant alter table
I have an SQL script to execute multiple times (must be reentrant).
One of the script line is
alter table MATABLE modify (MADATA null);
This commands works well when the 'not null' constraint for ...
0
votes
1answer
235 views
Passing function call as a parameter to printf & Reentrancy
As per my knowledge , printf() is threadsafe and not reentrant.
Now if I pass the result of a function call as a parameter like this:
printf("\"%d\" squared is \"%d\".\n", 5, squareOfInteger(5));
...
-2
votes
1answer
267 views
Is the function who contains thread-local variable re-entrant?
Take the following code using thread_local variable as an example:
void func() {
thread_local int a;
......
}
According to Wikipedia, I know it is a thread_safety function. But should we ...
0
votes
1answer
285 views
synchronized method override- thread acquires lock on which object?
This question came in my mind from an example of Java Concurrency in Practice. In chapter2 of the book , we get an example like this , I am not copying that completely. Lets say we have following ...
1
vote
1answer
32 views
WCF how to connect to multiple running callbacks
I've created a WCF solution where I can kick off several simultaneous long running processes that report progress and have the option to cancel each one individually. I can disconnect the client and ...
2
votes
4answers
1k views
s/360 assembly: how to implement a call stack
I would like to write a function (in hlasm) which calls itself and other functions.
On a x86 or z80 (and probably others) you would do just call function and at the end of it a ret. The processor ...
0
votes
0answers
132 views
Are service callbacks not reentrant in practice?
I am reading "Android programming" by Erik Hellman, and after several "warnings" :-) that service is running in the main activity UI thread I started to wonder if the callbacks are also run in the ...
1
vote
1answer
87 views
What happens if a non-re-entrant linux function (say select) does not finish execution?
I was reading this question and learned that 'select' is not reentrant. So what happens if a signal is delivered (for example SIGKILL) while we're in the middle of it. Does this mean we can never use ...
3
votes
2answers
481 views
Are event handlers re-entrant in Embarcadero C++Builder?
I'd like to ask some advice on how handle an Embarcadero CB10.1 issue with re-entrancy. Compiled in Debug configuration with "Disable all optimizations" set to true. I'm running on Win7.
I have a ...
3
votes
2answers
214 views
Is this function considered as re-entrant?
I have a function with the following implementation:
void func (uint8 index, uint8 status)
{
if (status == 1)
{
myArrayOfStructures[index].status = 1;
}
else if (status == 0)
{
...
4
votes
1answer
234 views
Thread safe, reentrant, async-signal safe putenv
I apologise in advance for what will be a bit of a code dump, I've trimmed as much unimportant code as possible:
// Global vars / mutex stuff
extern char **environ;
pthread_mutex_t env_mutex = ...
3
votes
2answers
117 views
Is Wikipedia wrong about reentrancy?
https://en.wikipedia.org/wiki/Reentrancy_(computing) (as of Dec 9, 2016) states that the following code is reentrant, despite modifying a global variable, because swap leaves it unchanged:
int t;
...