Comments (6)
Hi @akash-akya,
Oh dear, that's bad, I'll have a look. Thank you for the detailed report.
from libvips.
I made a tiny C prog to reproduce this:
/* Stress-test libvips fft.
*
* Compile with:
*
* gcc -g -Wall soak8.c `pkg-config vips --cflags --libs`
*
* Run with:
*
* ./a.out ~/pics/k2.jpg
*/
#include <unistd.h>
#include <vips/vips.h>
/* How many ffts we run at once.
*/
#define NUM_IN_PARALLEL (32)
/* Number of ffts we do in total.
*/
#define TOTAL_OPERATIONS (NUM_IN_PARALLEL * 2000)
static GThreadPool *pool = NULL;
/* What we run as a thread.
*/
static void
worker( void *data, void *user_data )
{
const char *file = (const char *) data;
VipsImage *im, *x;
if( !(im = vips_image_new_from_file( file, NULL )) )
vips_error_exit( NULL );
if( vips_crop( im, &x, 0, 0, 512, 512, NULL ) )
vips_error_exit( NULL );
g_object_unref( im );
im = x;
if( vips_fwfft( im, &x, 0.1, NULL ) )
vips_error_exit( NULL );
g_object_unref( im );
im = x;
if( !(x = vips_image_copy_memory( im )) )
vips_error_exit( NULL );
g_object_unref( im );
g_object_unref( x );
}
int
main( int argc, char **argv )
{
int i;
if( VIPS_INIT( argv[0] ) )
return( -1 );
pool = g_thread_pool_new( worker, NULL, NUM_IN_PARALLEL, FALSE, NULL );
for( i = 0; i < TOTAL_OPERATIONS; i++ )
g_thread_pool_push( pool, argv[1], NULL );
/* Wait for all threads to finish.
*/
g_thread_pool_free( pool, FALSE, TRUE );
sleep( 1 );
return( 0 );
}
And it crashes every time with a double free error. valgrind seems to pass, annoyingly.
from libvips.
That's quick. I'll reuse your snippet when I hit something similar next time!
Based on libfwfft
thread safety docs, planer call must thread safe, right?
from libvips.
Yes, it probably just needs a few more locks.
from libvips.
OK, fixed in 8.15.1 and credited to you. Thanks again!
from libvips.
@jcupitt Thanks! You don't really have to.
I am a lurker of this repo and I learned so much from your answers, comments and code in this repo and Stack Overflow. You answer every simple question with so much patience! Thank you for that :)
from libvips.
Related Issues (20)
- Row sums from vips_project do not necessarily give the same value like summing img(i,j) along i HOT 2
- Looks like 8.15.2 tag is wrong? HOT 1
- vips 8.15.2 failed to build with latest xcode HOT 11
- HDR AVIF to HEIC (hdr) HOT 4
- Feature request: Support SDR→HDR via RTX HDR (upmapping / inverse tone mapping)
- AVIF with bitdepth 10 or 12 crashes
- Add nclx->icc colour management to heifload HOT 24
- Segmentation fault when performing very large number of operations HOT 1
- Subsample mode not working with jpegli HOT 4
- Add target write to `rawsave` HOT 2
- Cannot link to proper libraries on Windows 11 Pro. HOT 1
- Thumbnail/Resize removes color on Alpine HOT 1
- Add support for fractional tiff values (eg. 10 or 12 bits per pixel) HOT 6
- Include JXL as Foreign TIFF Compression HOT 3
- The position of "#include <vips/vips8>" matters. HOT 2
- distance transform HOT 1
- CMYK -> SRGB conversion results in color change
- vips dzsave crashes when saving tiff to avif HOT 3
- OSError: [Errno 30] Read-only file system: '/my' HOT 1
- Error using vips-cpp statically with msvc
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libvips.