Replies: 7 comments 121 replies
-
Hello @GitFred4, You need to be careful when using the inplace operations in a threaded program, since they modify the image. The simplest solution is usually to call The best solution is probably to NOT use the inplace operations at all! They are only there for interactive "paintbox"-style programs, they are not supposed to be used for general image processing. Sometimes they are necessary for performance, but there's usually another solution. What's your use-case? |
Beta Was this translation helpful? Give feedback.
-
I will try that. The images are not shared between threads. I will see if I can replace the data() function, but I don't think it will work in all cases. |
Beta Was this translation helpful? Give feedback.
-
Did you call |
Beta Was this translation helpful? Give feedback.
-
Ah bummer, to summarize this issue:
@jcupitt Do you have any idea what could be the reason for this? (I started a new discussion thread as the other one is already quite full) |
Beta Was this translation helpful? Give feedback.
-
I had another thought -- the thing that sizes the threadpool up and down is relatively new and less well tested. Perhaps there's an issue there? If it sizes the threadpool down too far, perhaps there are so few threads that evaluation cannot continue and it deadlocks? It doesn't seem likely, but who knows. It might be worth testing a binary without that feature. We could maybe add a new env var, perhaps |
Beta Was this translation helpful? Give feedback.
-
I suspect this is a issue in Details@@ -19,7 +19,7 @@ int main(int argc, char* argv[])
for (auto& thread : test) {
thread = std::thread([] {
VipsImage* text, * text2;
- VipsImage* mem, * mem2;
+ double out, out2;
if (vips_text(&text, "Test Text", "font", "sans 50", nullptr))
vips_error_exit(nullptr);
@@ -30,16 +30,14 @@ int main(int argc, char* argv[])
if (!text2 || !text)
vips_error_exit(nullptr);
- if (!(mem = vips_image_copy_memory(text)))
+ if (vips_avg(text, &out, nullptr))
vips_error_exit(nullptr);
- if (!(mem2 = vips_image_copy_memory(text2)))
+ if (vips_avg(text2, &out2, nullptr))
vips_error_exit(nullptr);
g_object_unref(text);
g_object_unref(text2);
- g_object_unref(mem);
- g_object_unref(mem2);
});
}
std::cout << "Join"; I had an attempt to sync Which seems to work, but I've no idea way 🤷♂️. Interestingly, the CI also fails on that commit:
@GitFred4's bisecting suggests that the issue might have been introduced in the threadpool scavenger (PR #3253). However, I'm not sure why it only fails in |
Beta Was this translation helpful? Give feedback.
-
This should be fixed after PR #4137. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have several threads, each processing its own image.
The images are only used in one thread.
Sometimes one of my threads does not finish and it always seems to get stuck in the data or inplace function of the vips::VImage class.
I can't reproduce the behaviour, it only happens sometimes. Maybe one in 1000 image inplace calls or less.
I have waited about 30-40 minutes and nothing has changed. Normally one inplace call should never exceed 20 seconds.
vips_concurrency was set to 5.
It always gets stuck in the g_cond_wait(s->cond, s->mutex); function in semaphore.c row 126

See attached Image of all running Threads.
Windows 10
LipVips 8.15.2
Beta Was this translation helpful? Give feedback.
All reactions