Skip to content

Instantly share code, notes, and snippets.

🐢
Learning rust and PostgreSQL

Lars-Magnus Skog ralphtheninja

🐢
Learning rust and PostgreSQL
Block or report user

Report or block ralphtheninja

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ralphtheninja
ralphtheninja / JOBS.md
Last active Jul 2, 2019
Use JOBS=max to speed up native node modules
View JOBS.md

When npm installs native node modules it uses node-gyp to compile code. This is the seam node uses for targeting different operating systems, e.g. OS X, linux, Windows etc.

By default node-gyp compiles using one core and if you have more than one you probably want to utilize that power to speed up compile time. The way node-gyp handles this is by using the JOBS environment variable, which sets the jobs variable here. This piece of code then checks the value of jobs to determine how many cores to use.

Note that if the value of JOBS is max then all cores will be used. So lets try this on leveldown. First lets check that JOBS isn't set yet:

lms@ux301|01:34|~/src/leveldb-repos/leveldown (master) $ echo $JOBS

View normalize.rs
if !pathNfilename_abs.is_null() {
let path = std::path::Path::new(
std::ffi::CStr::from_ptr(pathNfilename_abs)
.to_str()
.unwrap(),
);
match fs::canonicalize(path) {
Ok(v) => {
return to_cstring(v.to_str().unwrap());
}
View cli-branch.txt
cd deltachat-node
cd deltachat-core-rust
git fetch
git checkout --track origin/cleanup-cli
git rebase origin/master
cd ..
node scripts/rebuild-core.js
./node_modules/.bin/node-gyp rebuild
cp deltachat-core-rust/target/release/deltachat.dll build/Release
View desktop crash
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Utf8Error { valid_up_to: 2532, error_len: Some(1) }', src/libcore/result.rs:999:5
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook
View deltachat core rust windows binaries
Directory of C:\projects\deltachat-node-d4bf8\deltachat-core-rust\target\release
05/30/2019 05:17 PM <DIR> .
05/30/2019 05:17 PM <DIR> ..
05/30/2019 05:06 PM 0 .cargo-lock
05/30/2019 05:06 PM <DIR> .fingerprint
05/30/2019 05:06 PM <DIR> build
05/30/2019 05:17 PM 3,272 deltachat.d
05/30/2019 05:17 PM 7,560,704 deltachat.dll
05/30/2019 05:17 PM 3,276 deltachat.dll.d
05/30/2019 05:17 PM 59,060 deltachat.dll.lib
View core dump when receiving message
of file /home/lms/src/deltachat/deltachat-core-rust/target/debug/examples/repl.
Use `info auto-load python-scripts [REGEXP]' to list them.
(gdb) bt
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:62
#1 0x000055973cada91a in std::ffi::c_str::CStr::from_ptr () at src/libstd/ffi/c_str.rs:963
#2 0x000055973bab05e7 in deltachat::dc_job::dc_job_do_DC_JOB_MOVE_MSG (context=0x55973dc23650, job=0x7f7aae9d9608) at src/dc_job.rs:493
#3 0x000055973baae12a in deltachat::dc_job::dc_job_perform (context=0x55973dc23650, thread=100, probe_network=0) at src/dc_job.rs:150
#4 0x000055973baad67a in deltachat::dc_job::dc_perform_imap_jobs (context=0x55973dc23650) at src/dc_job.rs:62
#5 0x000055973ba40ded in repl::start_threads::{{closure}} () at examples/repl/main.rs:192
#6 0x000055973ba2c533 in std::sys_common::backtrace::__rust_begin_short_backtrace (f=...) at /rustc/5d20ff4d2718c820632b38c1e49d4de648a9810b/src/libstd/sys_common/backtrace.rs:136
View desktop-gdb-attached.log
[New LWP 32297]
[New LWP 32716]
[New LWP 32722]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f64bb5426c1 in buf_redux::buffer::BufImpl::bytes_written ()
from /home/lms/src/deltachat/deltachat-node/build/Release/deltachat.node
(gdb) thread apply all bt
Thread 35 (Thread 0x7f649846f700 (LWP 32722)):
View maybe-related.txt
View panic.log
data1: 0, [0/1691]
data2:
'Cannot delete on IMAP, DeltaChat/11610 does not match Mr.34AyjuXAo7Z.LlkdQLUg7Zz@deltachat.de.' }
main/deltachat/login WARNING [ { columnNumber: 11,
lineNumber: 105,
fileName:
'/home/lms/src/deltachat/deltachat-desktop/src/main/deltachat/login.js',
functionName: 'DeltaChat.dc.on',
source:
' at DeltaChat.dc.on (/home/lms/src/deltachat/deltachat-desktop/src/main/deltachat/login.js:105:11)' },
View desktop-crash.log
main/ipc DEBUG [] RENDER
failed to close connection: Bad("No mailbox selected.")
main/state INFO [] Saving state to /home/lms/.config/DeltaChat/config.json
failed to connect: Io(Custom { kind: Other, error: StringError("failed to lookup address information: Name or service not known") })
You can’t perform that action at this time.