about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2013-10-16 Fix a race in registerFailedPath()Eelco Dolstra1-2/+1
Registering the path as failed can fail if another process does the same thing after the call to hasPathFailed(). This is extremely unlikely though.
2013-10-16 Convenience macros for retrying a SQLite transactionEelco Dolstra1-46/+42
2013-10-16 Don't wrap read-only queries in a transactionEelco Dolstra1-6/+0
There is no risk of getting an inconsistent result here: if the ID returned by queryValidPathId() is deleted from the database concurrently, subsequent queries involving that ID will simply fail (since IDs are never reused).
2013-10-16 Print a distinct warning for SQLITE_PROTOCOLEelco Dolstra1-4/+8
2013-10-16 Treat SQLITE_PROTOCOL as SQLITE_BUSYEelco Dolstra1-1/+1
In the Hydra build farm we fairly regularly get SQLITE_PROTOCOL errors (e.g., "querying path in database: locking protocol"). The docs for this error code say that it "is returned if some other process is messing with file locks and has violated the file locking protocol that SQLite uses on its rollback journal files." However, the SQLite source code reveals that this error can also occur under high load: if( cnt>5 ){ int nDelay = 1; /* Pause time in microseconds */ if( cnt>100 ){ VVA_ONLY( pWal->lockError = 1; ) return SQLITE_PROTOCOL; } if( cnt>=10 ) nDelay = (cnt-9)*238; /* Max delay 21ms. Total delay 996ms */ sqlite3OsSleep(pWal->pVfs, nDelay); } i.e. if certain locks cannot be not acquired, SQLite will retry a number of times before giving up and returing SQLITE_PROTOCOL. The comments say: Circumstances that cause a RETRY should only last for the briefest instances of time. No I/O or other system calls are done while the locks are held, so the locks should not be held for very long. But if we are unlucky, another process that is holding a lock might get paged out or take a page-fault that is time-consuming to resolve, during the few nanoseconds that it is holding the lock. In that case, it might take longer than normal for the lock to free. ... The total delay time before giving up is less than 1 second. On a heavily loaded machine like lucifer (the main Hydra server), which often has dozens of processes waiting for I/O, it seems to me that a page fault could easily take more than a second to resolve. So, let's treat SQLITE_PROTOCOL as SQLITE_BUSY and retry the transaction. Issue NixOS/hydra#14.
2013-10-08 printStats(): Print the size of the symbol table in bytesEelco Dolstra3-0/+15
2013-10-08 Deduplicate filenames in PosEelco Dolstra3-6/+7
This saves ~4 MiB of RAM for NixOS system instantiation, and ~18 MiB for "nix-env -qa".
2013-10-08 Treat undefined variable errors consistentlyEelco Dolstra3-2/+8
Previously, a undefined variable inside a "with" caused an EvalError (which can be caught), while outside, it caused a ParseError (which cannot be caught). Now both cause an UndefinedVarError (which cannot be caught).
2013-10-08 Show the exact position of undefined variablesEelco Dolstra4-21/+18
In particular, undefined variable errors in a "with" previously didn't show *any* position information, so this should help a lot in those cases.
2013-10-08 Remove some unused functionsEelco Dolstra1-15/+0
2013-10-08 Merge VarRef into ExprVarEelco Dolstra4-21/+8
2013-10-07 Don't show calls to primops in stack tracesEelco Dolstra1-6/+1
Since they don't have location information, they just give you crap like: while evaluating the builtin function `getAttr': while evaluating the builtin function `derivationStrict': ...
2013-10-02 Fix segfault in nix-repl / hydra-eval-jobsEelco Dolstra1-3/+3
If a "with" attribute set fails to evaluate, we have to make sure its Env record remains unchanged. Otherwise, repeated evaluation gives a segfault: nix-repl> :a with 0; { a = x; b = x; } Added 2 variables. nix-repl> a error: value is an integer while an attribute set was expected nix-repl> b Segmentation fault
2013-10-02 Report OOM errors betterEelco Dolstra2-1/+8
2013-10-02 Fix typoEelco Dolstra1-1/+1
2013-09-17 RestoreSink: Slightly reduce the number of concurrent FDsEelco Dolstra1-0/+1
2013-09-06 Remove stray debug lineEelco Dolstra1-2/+0
2013-09-06 Don't apply the CPU affinity hack to nix-shell (and other Perl programs)Eelco Dolstra4-7/+10
As discovered by Todd Veldhuizen, the shell started by nix-shell has its affinity set to a single CPU. This is because nix-shell connects to the Nix daemon, which causes the affinity hack to be applied. So we turn this off for Perl programs.
2013-09-03 nix-env -i: Add a flag ‘--remove-all’ / ‘-r’Eelco Dolstra1-17/+25
This is equivalent to running ‘nix-env -e '*'’ first, except that it happens in a single transaction. Thus, ‘nix-env -i pkgs...’ replaces the profile with the specified set of packages. The main motivation is to support declarative package management (similar to environment.systemPackages in NixOS). That is, if you have a specification ‘profile.nix’ like this: with import <nixpkgs> {}; [ thunderbird geeqie ... ] then after any change to ‘profile.nix’, you can run: $ nix-env -f profile.nix -ir to update the profile to match the specification. (Without the ‘-r’ flag, if you remove a package from ‘profile.nix’, it won't be removed from the actual profile.) Suggested by @zefhemel.
2013-09-03 nix-env: Use wildcard match by defaultEelco Dolstra2-13/+8
That is, you don't need to pass '*' anymore, so nix-env -qa is equivalent to nix-env -qa '*'
2013-09-03 nix-env: Load files in ~/.nix-defexpr on demandEelco Dolstra3-3/+18
So if you do "nix-env -qa -A nixos", then other channels won't be parsed/evaluated at all.
2013-09-03 Check for name collisions in the input Nix expressionsEelco Dolstra1-3/+9
2013-09-03 Work on Values instead of ExprsEelco Dolstra4-50/+62
This prevents some duplicate evaluation in nix-env and nix-instantiate. Also, when traversing ~/.nix-defexpr, only read regular files with the extension .nix. Previously it was reading files like .../channels/binary-caches/<name>. The only reason this didn't cause problems is pure luck (namely, <name> shadows an actual Nix expression, the binary-caches files happen to be syntactically valid Nix expressions, and we iterate over the directory contents in just the right order).
2013-09-03 ReformatEelco Dolstra1-33/+35
2013-09-03 Get rid of the parse tree cacheEelco Dolstra6-34/+35
Since we already cache files in normal form (fileEvalCache), caching parse trees is redundant. Note that getting rid of this cache doesn't actually save much memory at the moment, because parse trees are currently not freed / GC'ed.
2013-09-02 Add some support code for nix-replEelco Dolstra3-12/+26
2013-09-02 Get rid of a signedness warningEelco Dolstra1-1/+1
2013-09-02 Fix whitespaceEelco Dolstra8-82/+82
2013-09-02 Only show trace messages when tracing is enabledEelco Dolstra1-4/+3
2013-09-02 Add an option to limit the log output of buildersEelco Dolstra3-0/+19
This is mostly useful for Hydra to deal with builders that get stuck in an infinite loop writing data to stdout/stderr.
2013-08-26 Simplify inherited attribute handlingShea Levy5-38/+21
This reduces the difference between inherited and non-inherited attribute handling to the choice of which env to use (in recs and lets) by setting the AttrDef::e to a new ExprVar in the parser rather than carrying a separate AttrDef::v VarRef member. As an added bonus, this allows inherited attributes that inherit from a with to delay forcing evaluation of the with's attributes. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-08-26 Fix typos, especially those that end up in the Nix manualIvan Kozik6-7/+7
2013-08-26 Fix personality switching from x86_64 to i686Gergely Risko1-1/+6
On Linux, Nix can build i686 packages even on x86_64 systems. It's not enough to recognize this situation by settings.thisSystem, we also have to consult uname(). E.g. we can be running on a i686 Debian with an amd64 kernel. In that situation settings.thisSystem is i686-linux, but we still need to change personality to i686 to make builds consistent.
2013-08-19 Store Nix integers as longsEelco Dolstra9-23/+25
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-08-14 TypoEelco Dolstra1-1/+1
2013-08-07 Respect MINSIGSTKSZ when allocating an alternative stackEelco Dolstra1-1/+1
http://hydra.nixos.org/build/5663577
2013-08-07 Fix build on non-LinuxEelco Dolstra1-0/+2
http://hydra.nixos.org/build/5662914
2013-08-07 Run the daemon worker on the same CPU as the clientEelco Dolstra8-4/+88
On a system with multiple CPUs, running Nix operations through the daemon is significantly slower than "direct" mode: $ NIX_REMOTE= nix-instantiate '<nixos>' -A system real 0m0.974s user 0m0.875s sys 0m0.088s $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m2.118s user 0m1.463s sys 0m0.218s The main reason seems to be that the client and the worker get moved to a different CPU after every call to the worker. This patch adds a hack to lock them to the same CPU. With this, the overhead of going through the daemon is very small: $ NIX_REMOTE=daemon nix-instantiate '<nixos>' -A system real 0m1.074s user 0m0.809s sys 0m0.098s
2013-08-06 Remove obsolete reference to ATermsEelco Dolstra1-3/+3
2013-08-02 In the profiler output, show function names (if available)Eelco Dolstra2-8/+8
2013-08-02 Let the ordering operators also work on stringsEelco Dolstra1-3/+6
E.g. ‘"foo" < "bar"’ now works.
2013-08-02 Add comparison operators ‘<’, ‘<=’, ‘>’ and ‘>=’Eelco Dolstra2-0/+7
2013-08-02 Add integer ‘-’, ‘*’ and ‘/’ operatorsEelco Dolstra1-1/+5
2013-08-02 Add a unary integer negation operatorEelco Dolstra1-2/+4
This allows saying "-1" instead of "builtins.sub 0 1".
2013-08-02 Overload the ‘+’ operator to support integer additionEelco Dolstra1-11/+19
2013-07-31 Make Env smallerEelco Dolstra2-21/+23
Commit 20866a7031ca823055a221653b77986faa167329 added a ‘withAttrs’ field to Env, which is annoying because it makes every Env structure bigger and we allocate millions of them. E.g. NixOS evaluation took 18 MiB more. So this commit squeezes ‘withAttrs’ into values[0]. Probably should use a union...
2013-07-31 Don't use NULLEelco Dolstra1-4/+2
2013-07-31 Avoid thunks when a fromWith var can be looked up without evaluationShea Levy2-8/+8
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-31 Delay evaulation of `with` attrs until a variable lookup needs themShea Levy2-7/+13
Evaluation of attribute sets is strict in the attribute names, which means immediate evaluation of `with` attribute sets rules out some potentially interesting use cases (e.g. where the attribute names of one set depend in some way on another but we want to bring those names into scope for some values in the second set). The major example of this is overridable self-referential package sets (e.g. all-packages.nix). With immediate `with` evaluation, the only options for such sets are to either make them non-recursive and explicitly use the name of the overridden set in non-overridden one every time you want to reference another package, or make the set recursive and use the `__overrides` hack. As shown in the test case that comes with this commit, though, delayed `with` evaluation allows a nicer third alternative. Signed-off-by: Shea Levy <shea@shealevy.com>
2013-07-30 Detect stack overflowsEelco Dolstra3-1/+80
Previously, if the Nix evaluator gets a stack overflow due to a deep or infinite recursion in the Nix expression, the user gets an unhelpful message ("Segmentation fault") that doesn't indicate that the problem is in the user's code rather than Nix itself. Now it prints: error: stack overflow (possible infinite recursion) This only works on x86_64-linux and i686-linux. Fixes #35.