Commit graph

2430 commits

Author SHA1 Message Date
Zachary Anderson 0c3d73967d VM eventhandler: Update epoll/kqueue even if the only event is an error
Otherwise, we may try to add an fd to epoll/kqueue when it is already
there.

Also avoid sending multiple notifications on an error.

related #24417

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2655893002 .
2017-01-25 13:50:00 -08:00
Florian Schneider c1e4e8ef72 Fix Windows debug assertion when cancelling pending i/o
When no pending i/o requests are found, CancelIoEx returns ERROR_NOT_FOUND.

This is ok, since there is nothing else to do before closing the handle.

Related to #22940.

TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2651033004 .
2017-01-24 17:33:51 -08:00
Florian Schneider 2e1eeaf446 Cancel pending i/o when closing stdin on Windows
When cancelling a subscription to stdin, there may be pending I/O operation
that need to be explicitly cancelled before closing the stdin handle.

Otherwise the program would sit waiting for input (until CR is pressed).

Fixes dart-lang/pub#1502
Fixes #22940

R=zra@google.com

Review-Url: https://codereview.chromium.org/2650063003 .
2017-01-24 14:47:39 -08:00
Martin Kustermann 3f0ea0f50e VM: Fix asan memory leak in some standalone tests
Fixes #28350

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2653583002 .
2017-01-23 19:45:28 +01:00
Ryan Macnak b46af1e75f Refactor snapshots pieces to include a section for loading instructions into the heap of a regular isolate.
Progress toward allowing each isolate to load a different snapshot.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2622053002 .
2017-01-23 10:25:02 -08:00
Zachary Anderson e2220c3ea8 VM eventhandler: Read "old" event mask before it can be modified.
related #24417

R=johnmccutchan@google.com, kustermann@google.com

Review-Url: https://codereview.chromium.org/2635253002 .
2017-01-23 08:54:52 -08:00
Zach Anderson 7730809f36 Revert "Reintroducing MallocHooks changes with fix for infinite loop in MallocHooks on Platform::Exit."
This reverts commit 7bf5d87017.

The lock introduced by this change in MallocHooksState is held across
a fork(), which causes deadlock in the child when execvpe() fails and
tries to acquire the lock when freeing memory.

Review-Url: https://codereview.chromium.org/2647793005 .
2017-01-20 23:52:31 -08:00
Ben Konyi 7bf5d87017 Reintroducing MallocHooks changes with fix for infinite loop in MallocHooks on Platform::Exit.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2643303003 .
2017-01-20 15:26:58 -08:00
Zachary Anderson 17fa9d47b2 GN: Only use -fPIC where needed
R=hausner@google.com

Review-Url: https://codereview.chromium.org/2642283003 .
2017-01-20 13:40:19 -08:00
Ben Konyi c9a4374ed9 Revert "Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project."
This reverts commit 5290052550.

Revert "Fixed segfault in Remove method."

This reverts commit 203f1ba222.

BUG=
TBR=zra@google.com

Review-Url: https://codereview.chromium.org/2647763003 .
2017-01-19 15:17:29 -08:00
Ben Konyi 5290052550 Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project.
Fixed build issues from original submission.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2623613003 .
Review-Url: https://codereview.chromium.org/2644903003 .
2017-01-19 13:15:56 -08:00
Ryan Macnak ce91f600ae Only look for an app snapshot embedded in a dynamic library in the AOT runtime.
This mode is only intended for simulating iOS for testing. User-facing app snapshots only use regular files.

Avoids an error message on Fuchsia.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2646733004 .
2017-01-19 12:59:54 -08:00
Ben Konyi 10686766cd Revert "Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project."
This reverts commit bcd7ba1056.

TBR=zra@google.com

BUG=

Review-Url: https://codereview.chromium.org/2645973002 .
2017-01-19 12:14:19 -08:00
Ben Konyi bcd7ba1056 Implemented basic heap memory allocation tracking in MallocHooks using hooks registered with tcmalloc. Also updated BUILD.gn files to account for include paths within the tcmalloc project.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2623613003 .
2017-01-19 12:09:07 -08:00
Zachary Anderson 306b0ec249 Fuchsia: Build an OS image that includes Dart's test suite.
Guarded by a GN argument, this CL builds a Fuchsia OS image
that includes Dart tree, including the test suite, packages,
test harness, and sufficient build output to run through the
test suite.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2547013003 .
2017-01-19 10:11:27 -08:00
Ryan Macnak 26a364f998 Support spawnUri in app snapshots.
- Don't mark core_isolate_snapshot_buffer as a const pointer.
 - Update app snapshots without code to not rewrite the VM isolate snapshot, as already done by app snapshots with code.

Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2637193002 .
2017-01-17 15:59:41 -08:00
Ryan Macnak 12a3699301 Revert "Support spawnUri in app snapshots."
Failures on IA32.

This reverts commit c6ecfe1746.

Review-Url: https://codereview.chromium.org/2631893002 .
2017-01-13 15:52:36 -08:00
Ryan Macnak c6ecfe1746 Support spawnUri in app snapshots.
Don't mark core_isolate_snapshot_buffer as a const pointer.

Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2623423007 .
2017-01-13 15:18:27 -08:00
Zachary Anderson 6f9dcaff9d Fuchsia: Disable service origin check. Bind service to all interfaces.
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2626043006 .
2017-01-13 12:27:17 -08:00
Ryan Macnak f89056f6cd Revert "Support spawnUri in app snapshots."
This reverts commit 593d4504b0.
This reverts commit 113aa64b98.
This reverts commit 422afa2ead.

Review-Url: https://codereview.chromium.org/2633543003 .
2017-01-13 11:02:44 -08:00
Ryan Macnak 422afa2ead Explicitly mark empty snapshots as extern.
TBR=asiva@google.com

Review-Url: https://codereview.chromium.org/2631763002 .
2017-01-13 10:59:08 -08:00
Ryan Macnak 113aa64b98 Windows apparently has stricter linkage rules.
TBR=asiva@google.com

Review-Url: https://codereview.chromium.org/2632553003 .
2017-01-13 10:51:51 -08:00
Ryan Macnak 593d4504b0 Support spawnUri in app snapshots.
Fixes #28368

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2628283002 .
2017-01-13 10:37:51 -08:00
Zachary Anderson deb2181067 Don't clobber SocketError's OSError on failed write and send.
related #25342

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2632543002 .
2017-01-12 15:51:45 -08:00
Ryan Macnak f51d1b229c Cleanup embedder API functions for app snapshots.
- Rename functions to make correspondence between JIT and AOT app snapshot clearer.
 - Update documentation on assembly output of AOT snapshots.
 - Remove old Dart_PrecompileJIT.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2611343002 .
2017-01-12 09:36:22 -08:00
Zachary Anderson c7d2f8276d Fuchsia: Fix deprecated jobs call
Review-Url: https://codereview.chromium.org/2628213002 .
2017-01-12 08:44:04 -08:00
Martin Kustermann 5dc73cacd2 VM: Avoid running atexit() handlers during exit() of a failed subprocess spawn
Somtimes execve() fails and then we fall back to exit(1) in the fork()ed but not
exeve()ed subprocess.

One of the issues is e.g. that we don't want to run LSAN in the fork()ed but not
execve()ed subprocess, the results will be bogus (plus the output of
LSAN is not read on the other side (i.e. the unix pipe is not drained) which
blocks the subprocess indefinitely).

R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2632483002 .
2017-01-12 14:20:34 +01:00
Florian Schneider bef4967ea1 Remove dart_noopt and related parts from the VM.
dart_noopt is not needed anymore because we have testing
and builbot integration of the real precompilation pipeline in place now.

Fixes #24569
Fixes #25726
Fixes #25845

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2624393002 .
2017-01-11 16:55:55 -08:00
Zachary Anderson 9509bd4443 Limit the number of outstanding file reads in the VM loader
related https://github.com/dart-lang/test/issues/373

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2626093003 .
2017-01-11 15:33:07 -08:00
Zachary Anderson a1579c6a45 Fuchsia: Implement recursive delete
Currently, readdir() doesn't fill out d_type correctly, so we just do
an extra stat() to get the file type.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2621093002 .
2017-01-10 15:08:39 -08:00
Zachary Anderson 245e62280e Fuchsia: Pass a job to launchpad_create()
This API will change soon such that passing 0 for the
job handle will prevent spawned processes from creating
new processes themselves.

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2621783003 .
2017-01-10 11:01:09 -08:00
Zachary Anderson a5d8a2f365 Fuchsia: Adds support for Process.kill()
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2619233003 .
2017-01-09 15:57:41 -08:00
Zachary Anderson 44e5ace2df Fuchsia: Remove overly-restrictive assert from eventhandler
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2625463002 .
2017-01-09 11:20:51 -08:00
Zachary Anderson 9b8ce83ef3 Fuchsia: Use new call to get thread CPU time
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2613283002 .
2017-01-07 14:45:34 -08:00
Adam Barth 8eeb9df82d Use the new MX_PROCESS_SIGNALED signal name
R=zra@google.com, abarth@google.com

Review-Url: https://codereview.chromium.org/2614253002 .
2017-01-06 14:19:18 -08:00
Ben Konyi 9ff7ee6132 Created placeholders for MallocHooks implementation and added define DART_USE_TCMALLOC to specifiy when tcmalloc is available.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2619443002 .
2017-01-06 12:38:11 -08:00
Martin Kustermann e0a427a957 Workaround attempt for timeout flakiness: Avoid running atexit() handlers in fork()ed process on linux
About this CL:

  The only purpose of `if (fork() == 0) exit(0)` is to wake up
  a thread in the parent process which might be blocked on `wait()`.

  There is no need to run atexit() handlers in the `fork()`ed child.

  This is a *workaround attempt* for a deadlocked `free()` call inside the
  processing of atexit handlers in glibc.

  (Side note: There might be better ways of notifying the thread, like sending a
   signal to the particular pthread with `pthread_kill` which would make the
   `wait()` syscall be interrupted.)

About the issue:

  It is still unclear why, in this particular case, the tcmalloc locks should
  be hold during the `exit()` call:

    * via a static initializer tcmalloc uses
        `pthread_atfork(before=ObtainAllLocks(),
                        after_parent=ReleaseAllLocks(),
                        after_child=ReleaseAllLocks())`
      to register locking & unlocking around `fork()`

    * glibc's `fork()` runs the either `after_parent` or `after_child` handlers
      (unconditionally) which should free the locks

    * the `exit()` call later should be free to malloc/free

  The [BUG] describes more in detail how we can hit a tcmalloc deadlock in a
  different situation (it's a linux kernel bug).
  Namely, if the linux kernel runs OOM during `fork()` and therefore fails to
  set the new thread-id. The glibc code hits an assert and tries to allocate
  memory before `after_parent`/`after_child` handlers were executed which
  deadlocks.

BUG=https://github.com/dart-lang/sdk/issues/28246
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2618723002 .
2017-01-05 13:56:01 +01:00
Kevin Millikin 50348f5f22 Fixes to patch files necessary to use the analyzer
The analyzer has a stricter patch parser than the VM.  Patch files
cannot change signatures of patched members.  Specifically, they cannot
change:

  - the return type
  - a parameter's name
  - a parameter to an initializing formal
  - an optional parameter's default value

BUG=
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2612043002 .
2017-01-05 12:23:51 +01:00
Zachary Anderson 5e2898887b Standardize errno's from a few dart:io File and Link calls
No new tests because I'm just returning more sensical errors in cases
that were already errors.

Not touching Windows. It's doing its own thing.

fixes #28201, #28202, #28204

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2612653003 .
2017-01-04 13:09:07 -08:00
Zachary Anderson 5c8510bca5 Make RandomAccessFile.writeFrom use the correct starting offset
fixes #28174

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2615673002 .
2017-01-04 09:33:28 -08:00
Zachary Anderson 1f6c914d67 Signal an error for File.lastModified on a directory
fixes #28173

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2616463004 .
2017-01-04 07:50:35 -08:00
Zachary Anderson 128313ec3c Signal an error for File.length on a directory
fixes #28172

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2615473002 .
2017-01-03 15:06:23 -08:00
Zachary Anderson 375322d3ab GN: Add option to build with TSAN
fixes #28216

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2614493002 .
2017-01-03 14:37:27 -08:00
Zachary Anderson 2ad9b921be Reland: Make File.create() fail when a directory exists at the same path
related #28170

Review-Url: https://codereview.chromium.org/2594413002 .
2016-12-22 08:12:53 -08:00
Kasper Lund 101552b033 Revert "Make File.create() fail when a directory exists at the same path"
The added test case fails in non-English locales.

This reverts commit f2604a3647.

TBR'ed.

R=zra@google.com
BUG=

Review-Url: https://codereview.chromium.org/2599723002 .
2016-12-22 09:56:45 +01:00
Zach Anderson f2604a3647 Make File.create() fail when a directory exists at the same path
fixes #28170

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2593913003 .
2016-12-21 15:19:23 -08:00
Zach Anderson 2b48261764 Fix Process.runSync error handling.
Now, failing to allocate a buffer for stderr or stdout will generate
an ENOMEM OSError exception.

Also previously, read() returning an error would cause buffers for
stderr and stdout to leak. After this change, they'll be reclaimed.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2596543002 .
2016-12-21 09:10:40 -08:00
Zachary Anderson 1f99052303 Fuchsia: Adds File::Copy()
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2591523002 .
2016-12-20 09:44:08 -08:00
Zachary Anderson 918b90ba46 Fuchsia: implement Process::Wait() for Process.runSync()
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2591473004 .
2016-12-20 09:30:00 -08:00
Zachary Anderson 1f289fc12b Fuchsia: resolve executable name, fetch environment vars
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2581363002 .
2016-12-16 21:23:20 -08:00