Comments (9)
@ozanh You're right; the static scan thread limit went away in YARA 4.0 and YR_MAX_THRERAD
serves no other purpose than API compatibility.
This means that for practical the number of concurrent YARA threads may be way higher than before – so perhaps it makes sense to be able to grow the callback data structure on demand.
from go-yara.
I might not entirely understand here... but would hardcoding this at 256 cause any potential constraints elsewhere if scanning with a large number of rules within a goroutine?
https://github.com/hillu/go-yara/blob/master/util.go#L9
from go-yara.
Hi @LancePendergrass
As I use the go-yara heavily, I had realized cbPool limit and took some actions to prevent crashes. Under normal circumstances, one cannot easily exceed the cbPool limit but I limit the number of yara scanner goroutines to min(64, 2 * number of CPU)
. We use go-yara in thousands of machines around the world and I haven't been informed about any bug related to this.
from go-yara.
Okay limiting to runtime.NumCPU() and leveraging a similar pattern to below seems to have worked. Thanks.
https://stackoverflow.com/a/25306241
from go-yara.
@lpendergrass By default, YARA concurrency is limited to 32 threads. If you limit your program to that value, you still should not run out of cbpool values.
If anyone has a good suggestion how to document the limit (and what those panics actually mean: PRs are welcome, of course.
from go-yara.
@hillu After my quick text search in yara source code, I couldn't find a limit for yaralib concurrency. YR_MAX_THREADS
or ERROR_TOO_MANY_SCAN_THREADS
aren't applicable for the library, but are used in yara cli and sandbox folders. Let me know if I missed something and let me know if it can be added to go-yara doc as a concurrency best practice.
from go-yara.
Dynamic growth of that cap sounds like the way to go but in lieu of that it might help to document it somewhere or indicate this in the exception message.
https://github.com/hillu/go-yara/blob/master/cbpool.go#L56
from go-yara.
Sure. If somebody wants to take a shot at it, I'm open to PRs.
from go-yara.
As of 3099294, dbPool has been replöaced with cgo.Handle
(or an equivalent implementation that is used on older Go versions).
Closing this issue. Feel free to reopen if the issue comes up again.
from go-yara.
Related Issues (20)
- ld: warning: directory not found for option '-L/usr/local/Cellar/yara/4.1.2/lib' HOT 1
- "invalid pointer on stack" panic HOT 5
- Is there a code sample or a tutorial for beginners somewhere? HOT 6
- Error when compiling go-yara HOT 4
- The problem of scanning the file with Chinese filename HOT 14
- using go-yara with my own compiled yara library without crypto HOT 3
- cannot convert file.Fd() (value of type uintptr) to type _Ctype_HANDLE HOT 14
- Module Install fails b/c pkg-config cannot find libcrypto which is needed by yara HOT 3
- Yara getting "lost" during file/process scanning HOT 4
- static build failed: undefined reference to `log2'
- Compiling the Windows 32-bit DLL using Visual C++ HOT 1
- 4.3.0 fails to cross compile on mingw
- Documentation Is Not Clear HOT 3
- There's no way to return an error from MemoryBlockIterator HOT 5
- yr_scanner_scan_file Using mmap is a dangerous operation HOT 9
- Unable to cross compile yara for windows on ubuntu HOT 5
- Is the new tag version expected ? HOT 1
- Shippable binary for OSX HOT 6
- Can‘t build yara module statically into executable HOT 2
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 go-yara.